[cod] AutoStart Cod

theo theo at dsl-only.net
Mon Mar 15 00:04:22 EST 2004


***I replied to the wrong message before, sorry for the duplicate.

This might be useful to you. I use this on the sof2 server I run and
will tweak it for CoD if I end up keeping my server. It was tweaked by
one of my buddies, go_jesse and it is easy to modify.

Please remember to give credit where it is due.

I use a crontab (0-59/5 * * * *  $HOME/bin/sof2_inf_osp.init check)
every five minutes and this script:

 

#!/bin/sh
#
# standard format startup script for sof2
#
# modified by jesse (go_jesse at yahoo.com)
# written by abfackeln at abfackeln.com
# 2001-02-19
######################################################

MYNAME=sof2_inf_osp.init

MYUSERID=sof2
MYDIR=/home/sof2
MYMOD=osp

STARTSCRIPT=llc_inf.cfg

MYLOGFILE="$MYDIR/$MYMOD/$MYNAME.log"
MYLOCKFILE="$MYDIR/$MYMOD/$MYNAME.lock"

MYEXECMD="screen -D -m -t inf /home/sof2/launch_inf_osp.sh"

#MYEXECMD="screen -m -d ./quake3-smp.x86 +set g_gametype $GAMETYPE +set
dedicated 1 +sets gamestartup \"`date +"%m-%d-%y %T"`\" +set fs_game
$MYMOD +exec $STARTSCRIPT"

if [ `whoami` = "root" ]; then
   MYEXECMD="nice -n -5 $MYEXECMD"
   chown $MYUSERID $MYDIR/sof2ded
   chmod u+s $MYDIR/sof2ded
fi

ulimit -c 0

case "$1" in
   start)
      echo -n "Starting SOF2 inf: "
      if [ -f $MYLOCKFILE ]; then
         echo "already running according to $MYLOCKFILE. Not started."
      else
         cd $MYDIR
         #$MYEXECMD &> /dev/null &
         $MYEXECMD &> ~/console_`date +%b_%d_%Y`.log &
         echo $! > $MYLOCKFILE
         echo "$MYNAME: started."
      fi
      ;;
   stop)
      echo -n "Stopping SOF2 CTF: "
      if [ ! -f $MYLOCKFILE ]; then
         echo "not found"
         exit 2
      fi
      kill -TERM `cat $MYLOCKFILE` > /dev/null
      rm -f $MYLOCKFILE
      echo "$MYNAME: stopped."
      ;;
   restart)
      if [ -f $MYLOCKFILE ]; then
         $0 stop
      fi
      $0 start
      ;;
   check)
      ## the next condition was devised by Chris Weiss for his ut-check
script
      ## ftp://xplug.sourceforge.net/pub/xplug/ut-check.tar.gz
      ## i have slightly modified it and integrated it here

      ## usage: call "ucc.init check" from a cron task every 5 minutes
or so
      ## output will be nothing if it was running
      ## else output will be a start message and the server will restart

      if [ -z "$(ps --no-headers -p $(cat $MYLOCKFILE 2>/dev/null)
2>/dev/null)" ]; then
         $0 restart
      fi
      ;;
   infinity)
      ## infinite loop to ensure that server is always up without use of
cron

      echo $$ > $MYLOCKFILE.8
      ## the number 8 is the infinity symbol sideways ;)  -abf.

      while [ 1 ]; do
         $0 check
         sleep 60
      done
      ;;
   die)
      $0 stop

      ## break infinity
      kill -TERM `cat $MYLOCKFILE.8`
      rm -f $MYLOCKFILE.8
      ;;
   *)
      echo "Usage: $0 {start|stop|restart|check|infinity|die}"
      exit 1
esac

exit 0

-----Original Message-----
From: George Lemos [mailto:listreader at lemosnet.com] 
Sent: Sunday, March 14, 2004 2:00 PM
To: cod at icculus.org
Subject: [cod] AutoStart Cod

I have been reading several different ways of starting the COD server.
Right
now what I have been doing the most is login as a user, use the command
SCREEN or NOHUP, start the server then logoff. That seems to work just
fine.


I was just wondering if this list ever passed around a way to auto start
the
COD dedicated server upon system reboot. I tried making an entry to the
rc.local file but that seemed to not work for me. 

OR.. Do the admins not auto start the server and just fire it up in a
similar method mentioned above and be done with it?

Thanks for sharing your experiences!

/g


---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.620 / Virus Database: 399 - Release Date: 3/11/2004
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.620 / Virus Database: 399 - Release Date: 3/11/2004
 




More information about the Cod mailing list