[cod] bash script

david.lauriou at wanadoo.fr david.lauriou at wanadoo.fr
Thu Jun 25 10:18:54 EDT 2009


  ----- Original Message ----- 
  From: tom nikitopoulos 
  To: Call of Duty server admin list. 
  Sent: Wednesday, June 17, 2009 6:23 PM
  Subject: Re: [cod] bash script


  thanks to all...i will research all of these
  ty


  On Wed, Jun 17, 2009 at 11:06 AM, Geoff Goas <gitman at gmail.com> wrote:

    here's the one i wrote up using start-stop-daemon (compiled from debian's dpkg package)

    http://fragile.anarchic-x.net/~cod2/startup_script.txt

    the options will need to be changed to suit your environment



    On Tue, Jun 16, 2009 at 9:33 AM, Albert D. Lawson <wb7awl at lawsonpc.com> wrote:


      Here's another one.  I'd use it as a more of a guide than an actual
      script because flavors
      of Linux vary...but it should give you an idea or two.  Note that
      depending on how you call the
      script, you can invoke different commands and/or config files...

      #!/bin/bash
      #
      #       /root/scripts/cod5
      #
      # Starts the Call of Duty 5 server daemon
      # To start the daemon at runtime, put the
      # script command "cod5 start" in your
      # /etc/rc.d/rc.local file.
      #

      HOME="/root/cod5"
      BIN="/root/cod5/codwaw_lnxded-bin"
      BATCH="/root/cod5/codwaw_lnxded"
      CLOSED="+set dedicated 2 +exec closed-server.cfg +map_rotate +set
      sv_punkbuster 0"
      OPEN="+set fs_localAppData $HOME +set dedicated 2 +exec server.cfg
      +map_rotate +set sv_punkbuster 1"
      #MOD="+set fs_basepath $HOME +set fs_homepath $HOME +set fs_localAppData
      $HOME +set fs_game mods/war +set dedicated 2 +exec custom.cfg
      +map_rotate +set sv_punkbuster 0"
      MOD="+set fs_basepath $HOME +set fs_homepath $HOME +set dedicated 2 +set
      fs_game mods/x5 +exec x5.cfg +map_rotate +set sv_punkbuster 1"
      LOCKFILE="/var/lock/subsys/cod5"
      NETIP="+set net_ip 192.168.0.253"

      RETVAL=0
      PROG="CoD5 WaW Server"

      up() {
             cd $HOME
             if test -f $LOCKFILE
             then
                 echo -n "The $PROG is already running!"
                 echo
             else
                 echo -n $"Starting $PROG in the CLOSED configuration!"
                 $BIN $CLOSED >/dev/null 2>&1 &
                 RETVAL=$?
                 [ $RETVAL -eq 0 ] && touch $LOCKFILE
                 echo
             fi
      }

      open() {
             cd $HOME
             if test -f $LOCKFILE
             then
                 echo -n "The $PROG is already running!"
                 echo
             else
                 echo -n $"Starting $PROG in the OPEN configuration!"
                 $BIN $OPEN >/dev/null 2>&1 &
                 RETVAL=$?
                 [ $RETVAL -eq 0 ] && touch $LOCKFILE
                 echo
             fi
      }
      war() {
             cd $HOME
             if test -f $LOCKFILE
             then
                 echo -n "The $PROG is already running!"
                 echo
             else
                 echo -n $"Starting $PROG in the WAR Configuration!"
                 $BIN $WAR >/dev/null 2>&1 &
                 RETVAL=$?
                 [ $RETVAL -eq 0 ] && touch $LOCKFILE
                 echo
             fi
      }
      start() {
             cd $HOME
             if test -f $LOCKFILE
             then
                 echo -n "The $PROG is already running!"
                 echo
             else
                 echo -n $"Starting $PROG in the Modified Game
      Configuration!"
                 $BIN $MOD >/dev/null 2>&1 &
                 RETVAL=$?
                 [ $RETVAL -eq 0 ] && touch $LOCKFILE
                 echo
             fi
      }

      stop() {
             echo -n $"Stopping $PROG"
             killall -9 $BIN
             RETVAL=$?
             [ $RETVAL -eq 0 ] && rm -f $LOCKFILE
             echo
      }

      clearpid() {
             echo -n $"Clearing PID Lockfile"
             rm -f $LOCKFILE
             echo
      }
      #
      #       See how we were called.
      #
      case "$1" in
       start)
             start
             ;;
       stop)
             stop
             ;;
       open)
             open
             ;;
       war)
             war
             ;;
       clearpid)
             clearpid
             ;;
       mod)
           mod
           ;;
       reload|restart)
             stop
             start
             RETVAL=$?
             ;;

       *)
             echo $"Usage: $0 {start|stop|restart|reload|open}"
             exit 1
      esac

      exit $RETVAL




      _______________________________________________
      cod mailing list
      cod at icculus.org
      http://icculus.org/mailman/listinfo/cod





    -- 
    Geoff Goas
    Network Engineer

    _______________________________________________
    cod mailing list
    cod at icculus.org
    http://icculus.org/mailman/listinfo/cod






------------------------------------------------------------------------------


  _______________________________________________
  cod mailing list
  cod at icculus.org
  http://icculus.org/mailman/listinfo/cod
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://icculus.org/pipermail/cod/attachments/20090625/3633c233/attachment.htm>


More information about the cod mailing list