[cod] CoD2 Linux Startup Arguments
Quint van Drosthagen
cod at se-easy.net
Fri Jan 20 08:10:19 EST 2006
Here my scripts.
Hope they help you
With this script you run the game as an dedicated user..
This script start the cod2.sh script under the user cod2 and renice the cod2
server to almost the highest level on linux. This means that cod2 always get
more prio then other processes.
Starttdm
su - cod2 -s /bin/bash -c '/games/cod2/cod2.sh starttdm'
sleep 5
renice -10 `ps -ef | grep cod2_lnxded | grep -v grep | awk '{print $2}'`
Here the cod2.sh script. You see in this script 3 names and 3 descriptions.
Because I'm running 2 dedicated servers and for wars 1 warserver. If you
only run one remove the sections in this script. This script uses screen to
put cod2 on the background etc. etc.
clear
PATH=/bin:/usr/bin:/sbin:/usr/sbin
NAME=cod2srvtdm
NAME2=cod2srvctf
NAME3=cod2srvwar
DESC="CoD2 dedicated server TDM"
DESC2="CoD2 dedicated server CTF"
DESC3="CoD2 dedicated war server"
if [[ `id -u` = 0 ]]
then
echo "You should run this script as user cod2 not as root"
echo "You sould use 'su - cod2 -s /bin/bash' to become cod2 user"
exit 1
fi
case "$1" in
startall)
echo "Starting $DESC: $NAME"
#screen -wipe 1>/dev/null 2>&1
screen -d -m -S $NAME /games/cod2/rungametdm.sh
echo "Starting $DESC2: $NAME2"
screen -d -m -S $NAME2 /games/cod2/rungamectf.sh
;;
starttdm)
echo "Starting $DESC: $NAME"
#screen -wipe 1>/dev/null 2>&1
screen -d -m -S $NAME /games/cod2/rungametdm.sh
;;
startctf)
echo "Starting $DESC2: $NAME2"
#screen -wipe 1>/dev/null 2>&1
screen -d -m -S $NAME2 /games/cod2/rungamectf.sh
;;
startwar)
echo "Starting $DESC3: $NAME3"
#screen -wipe 1>/dev/null 2>&1
screen -d -m -S $NAME3 /games/cod2/rungamewar.sh
;;
stopall)
if [[ `screen -ls |grep $NAME` ]]
then
echo -n "Stopping $DESC: $NAME"
kill `screen -ls |grep $NAME |awk -F . '{print $1}'|awk '{print $1}'`
screen -wipe 1>/dev/null 2>&1
echo " ... done."
else
echo "Coulnd't find a running $DESC"
fi
if [[ `screen -ls |grep $NAME2` ]]
then
echo -n "Stopping $DESC2: $NAME2"
kill `screen -ls |grep $NAME2 |awk -F . '{print $1}'|awk '{print
$1}'`
screen -wipe 1>/dev/null 2>&1
echo " ... done."
else
echo "Coulnd't find a running $DESC2"
fi
;;
stoptdm)
if [[ `screen -ls |grep $NAME` ]]
then
echo -n "Stopping $DESC: $NAME"
kill `screen -ls |grep $NAME |awk -F . '{print $1}'|awk '{print $1}'`
#screen -wipe 1>/dev/null 2>&1
echo " ... done."
else
echo "Coulnd't find a running $DESC"
fi
;;
stopctf)
if [[ `screen -ls |grep $NAME2` ]]
then
echo -n "Stopping $DESC2: $NAME2"
kill `screen -ls |grep $NAME2 |awk -F . '{print $1}'|awk '{print
$1}'`
#screen -wipe 1>/dev/null 2>&1
echo " ... done."
else
echo "Coulnd't find a running $DESC2"
fi
;;
stopwar)
if [[ `screen -ls |grep $NAME3` ]]
then
echo -n "Stopping $DESC3: $NAME3"
kill `screen -ls |grep $NAME3 |awk -F . '{print $1}'|awk '{print
$1}'`
#screen -wipe 1>/dev/null 2>&1
echo " ... done."
else
echo "Coulnd't find a running $DESC3"
fi
;;
restart)
if [[ `screen -ls |grep $NAME` ]]
then
echo -n "Stopping $DESC: $NAME"
kill `screen -ls |grep $NAME |awk -F . '{print $1}'|awk '{print $1}'`
screen -wipe 1>/dev/null 2>&1
echo " ... done."
else
echo "Coulnd't find a running $DESC"
fi
if [[ `screen -ls |grep $NAME2` ]]
then
echo -n "Stopping $DESC2: $NAME2"
kill `screen -ls |grep $NAME2 |awk -F . '{print $1}'|awk '{print
$1}'`
screen -wipe 1>/dev/null 2>&1
echo " ... done."
else
echo "Coulnd't find a running $DESC2"
fi
echo -n "Starting $DESC: $NAME"
cd $DIR
screen -wipe 1>/dev/null 2>&1
screen -d -m -S $NAME /games/cod2/rungametdm.sh
echo " ... done."
echo -n "Starting $DESC2: $NAME2"
cd $DIR
screen -wipe 1>/dev/null 2>&1
screen -d -m -S $NAME2 /games/cod2/rungamectf.sh
echo " ... done."
;;
*)
echo "Usage: $0
{startall|startctf|starttdm|startwar|stopall|stopctf|stoptdm|
stopwar|restart}"
exit 1
;;
esac
exit 0
The above script runs a script rungametdm.sh (or ctf or war) this final
script is there to make a failover for the server. This script tests every
60 seconds if cod2 is still running if not it will start it. You see in the
section N= a grep with the cfg file for the server. In this script is it
also so that you have to grep the name of your cfg file or this script will
fail and start cod2 every 60 seconds.;-)
#!/bin/bash
export LD_LIBRARY_PATH=/games/cod2:$LD_LIBRARY_PATH
while true
do
N=`ps -ef | grep cod2_lnxded | grep -v grep | grep servertdm.cfg
| wc -l`
if [ $N -eq 0 ]
then
kill `ps -ef |grep cod2 | grep servertdm.cfg |grep -v grep |grep -v
bash|grep -v SCREEN|grep -v vmware | awk '{print $2}'`
cd /games/cod2/
./cod2_lnxded +set fs_game se-easy.net +set net_IP 217.19.28.175 +set
net_port 28960 +set developer 2 +set cheats 0 +set logfile 2 set g_log
Server1_tdm.log +exec servertdm.cfg &
fi
sleep 60
done
Hope this helps. Good luck.;-)
Greetz
Quint
-----Original Message-----
From: Prism [mailto:prism27 at gmail.com]
Sent: donderdag 19 januari 2006 23:35
To: cod at icculus.org
Subject: [cod] CoD2 Linux Startup Arguments
Hey guys,
Can someone remind of the startup commands for the linux dedicated server?
Cheers
--
~ Sion "Prism" Duncan.
Email : prism27 at gmail.com <mailto:prism27 at gmail.com>
Web : http://www.prism27.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://icculus.org/pipermail/cod/attachments/20060120/bf29db8d/attachment.htm>
More information about the Cod
mailing list