[cod] server on SCREEN - /etc/init.d/startupscript

splatter at d-g-c.de splatter at d-g-c.de
Mon Dec 3 01:46:45 EST 2007


#########################################################
# STARTSCRIPT FOR cod4 SERVERS #
#########################################################
# USE AT YOUR OWN RISK!!!!!!!!!!! #
# SCREEN must be installed on your server! #
#########################################################
# Vars: #
# G_USER Username #
# NAME Screen-Name #
# DESC Server-Description #
# PARAMS Start-Parameters #
# DIR HLDS Directory (absolut) #
# SCRIPT Serverstart-Script #
# DAEMON Daemon #
#########################################################
# OPTIONS: (start|stop|restart|status) #
#########################################################

################## User ################################
# Username of the Linux User running the CoD4 server
# (do NOT use root)
G_USER=dgc
################## Vars #################################
# Screen NAME
# Attach Screen : # screen -r NAME
# Detach Screen : # [CTRL]+[A]; [D]
# Don't press [CTRL]+[C] it will terminate screen
NAME=toaster
IP=87.106.166.40
PORT=28960
MAXCL=16
PB=1
################## Server Description ###################
# Single Word DESC=myserver
# Multiple Words DESC="This is my Server"
DESC="DGC cod4 Server"
################## Parameter ############################
# CAN USE: +servercfgfile server.cfg OR +exec server.cfg
PARAMS="+set dedicated 2 +set sv_punkbuster $PB +set net_ip $IP +set 
net_port $PORT +set sv_maxclients $MAXCL +exec $NAME.cfg +set g_gametype 
sd +map mp_vacant"
################## Directory ############################
# Path to the cod4-Directory (absolute)
DIR=/home/dgc/cod4
################## DAEMON ##############################
# Name of the startup script and binary
#SCRIPT=cod4_lnxded
SCRIPT=cod4_lnxded
BIN=cod4_lnxded-bin
########################################################
#### Do NOT edit anything below this line! ! ! ####
########################################################

DAEMON=$DIR/$SCRIPT

case "$1" in
start)
if [[ `su $G_USER -c "screen -ls | grep $NAME"` ]]
then
echo "$DESC $NAME is already running!"
else
echo "Starting $DESC $NAME "
su $G_USER -c "cd $DIR; screen -d -m -S $NAME $DAEMON $PARAMS"
fi
;;

stop)
if [[ `su $G_USER -c "screen -ls | grep $NAME"` ]]
then
echo -n "Stopping $DESC $NAME "
kill `ps aux | grep -i screen | grep -i $NAME | awk '{print $2}'`
echo " ... done."
else
echo "No running $DESC $NAME was found!"
fi
;;

restart)
if [[ `su $G_USER -c "screen -ls | grep $NAME"` ]]
then
echo -n "Stopping $DESC $NAME "
kill `ps aux | grep -i screen | grep -i $NAME | awk '{print $2}'`
echo " ... done."
else
echo "No running $DESC $NAME was found!"
fi

echo -n "Starting $DESC $NAME"
su $G_USER -c "cd $DIR; screen -d -m -S $NAME $DAEMON $PARAMS"
echo " ... done."
;;

status)
ps aux | grep -v grep | grep $BIN | grep $NAME > /dev/null
CHECK=$?
[ $CHECK -eq 0 ] && echo "$DESC $NAME is online" || echo "$DESC $NAME is 
offline"
;;
*)

echo "Use: $0 {start|stop|restart|status}"
exit 1
;;
esac

exit 0


After starting you cod4 server with this script you have to "su" to the 
linux user which is running the server:
su dgc -c "screen -r"

gl Florian


Randy Wheeler schrieb:
> screen is the only way to fly
>
>
>
> MrScary
>
> www.hellbentgaming.com <http://www.hellbentgaming.com>
>
>
> On Dec 2, 2007 8:14 PM, Dallas Crandall < dallas at crd-dwc.com 
> <mailto:dallas at crd-dwc.com>> wrote:
>
>      
>
>     Yep, not sure I would run them any other way. Screen is a great
>     tool. It is possible to run several servers under different screen
>     sessions, in one terminal.
>
>     Dallas
>
>      
>
>     -----Original Message-----
>     *From:* Sido - Callofduty.pl [mailto:sido.cod at gmail.com
>     <mailto:sido.cod at gmail.com>]
>     *Sent:* Sunday, December 02, 2007 2:17 PM
>     *To:* cod at icculus.org <mailto:cod at icculus.org>
>     *Subject:* [cod] server on SCREEN
>
>      
>
>     Does anybody run COD4 servers on screen? Is it better t run on
>     screen or maybe on normal console?
>     Does screen decrease performance on COD4 server?
>
>     Regards
>     -- 
>     sido
>     www.callofduty.pl <http://www.callofduty.pl>
>
>
>
>
> -- 
> Randy Wheeler 




More information about the Cod mailing list