[cod] Restart script

Steffen Rieker begbie at begbie.ws
Tue Nov 27 16:14:53 EST 2007


Hi m8s,

here is a simpel controlscript:

| #!/bin/sh
# (C)2006 by Begbie
# Modfy this part:
SERVERPFAD="/path/to/your/cod4/" # absolute path on your server
STARTBEFEHL="linuxq3ded +set dedicated 1 +com_hunkMegs 16 +exec 
my_ffa.config" # Start command of your servers
SERVERPREFIX="Q3A" # us a unique prefix for your server
SERVERNAME="Krieg_in_der_Nachbarschaft" # give the baby a name (just for 
the script)

# on this part you don't need to change anything
TEILER="_"
SERVERPID=`screen -ls | grep -F $SERVERPREFIX |cut -f 2 |cut -d . -f 1`

case "$1" in
start)
if [ -z "$SERVERPID" ] ; then
echo -n -e "Starten des Servers "$SERVERPREFIX $SERVERNAME "..... "
screen -AmSd $SERVERPREFIX$TEILER$SERVERNAME "./"$SERVERPFAD$STARTBEFEHL
wait
echo -n -e "\tdone\n"
else echo -n -e "\nServer laeuft bereits (PID: " $SERVERPID ")\n
;;

stop)
if [ -z "$SERVERPID" ] ; then
echo -n -e "\nServer laeuft nicht!\nWas nicht laeuft, kann man nicht 
anhalten:)\n"
else
echo -n -e "Stoppen des Servers "$SERVERPREFIX $SERVERNAME "..... "
kill -s TERM $SERVERPID
wait
;;

restart)
$0 stop
echo -n -e "30 Sekunden Warten.....\n "
sleep 5s
echo -n -e "noch 25 Sekunden...\n"
sleep 5s
echo -n -e "noch 20 Sekunden...\n"
sleep 5s
echo -n -e "noch 15 Sekunden...\n"
sleep 5s
echo -n -e "noch 10 Sekunden...\n"
sleep 5s
echo -n -e "noch 5 Sekunden...\n"
sleep 1
echo -n -e "4\n"
sleep 1
echo -n -e "3\n"
sleep 1
echo -n -e "2\n"
sleep 1
echo -n -e "1\n"
sleep 1
echo -n -e "0\n"
$0 start
;;

status)
if [ -z "$SERVERPID" ] ; then
echo -n -e "Server "$SERVERPREFIX $SERVERNAME "is not running!\n"
else
echo -n -e "\nServer "$SERVERPREFIX $SERVERNAME "running! (PID: " 
$SERVERPID ")\n"
fi
;;

**)
echo -n -e "\nUsage: scriptname start | stop | restart | status\n\n\n"
;;
esac|

Just copy to a file and make it executable. But always remember: do not 
run game server as root.

cheers
.:SO:.Begbie

P.S.: Thanks rayn

Vadim Clyne-Kelly schrieb:
> just use the same one as you used in MOHAA. just change the paths
>
> On 27/11/2007, *Sander* <sanderrednas at xs4all.nl 
> <mailto:sanderrednas at xs4all.nl>> wrote:
>
>     Hi guys,
>
>     Got our public server up and running with PB and everything is
>     working good!
>     Thanks Ryan for another good job!
>
>     Though I was wondering if someone has a decent restart script. I
>     used to
>     have one for Medal of Honor : Allied Assault.
>     It's just a small script with something about sleep 15s etc and then
>     restart. So if you do an rcon quit the server restarts and doesn't
>     die.
>     Also does someone have a decent rcon list, been going through some
>     sites
>     but besides some basic settings I couldn't really find a complete
>     list.
>
>     Thanks for your time.
>
>     / Sander
>
>     ---
>     To unsubscribe, send a blank email to cod-unsubscribe at icculus.org
>     <mailto:cod-unsubscribe at icculus.org>
>     Mailing list archives: http://icculus.org/cgi-bin/ezmlm/ezmlm-cgi?38
>
>
>
>
>
> -- 
> Thanks,
> Vadim 


-- 
.:SO:.Begbie
Member des Schwarzen Orden
www.schwarzer-orden.com
Man trift sich...:-)




More information about the Cod mailing list