[cod] monitoring the server?

Walker walkertje at gmail.com
Mon May 29 14:03:12 EDT 2006


Hi there,

check out the tool kkrcon (http://kkrcon.sourceforge.net/) and this script.

I'm not using it, just found it once and thought it might come in handy some
time...
Hope it helps.

#!/bin/sh
tf1="temp1"
    kkrcon.pl -a instertserverip -p insertserverport -t old
insertrconpassword status > $tf1

    # total number of lines in output
    tnl=`wc $tf1 | awk '{print $1}' `

    # tnl=1 - server doesnt respond. crash/wrong ip/port
    # tnl=2 - bad password
    # tnl=5 - server empty

    if [ "$tnl" -le 1 ]; then
      sleep 30
   # lets try again, in case server was restarting map
   kkrcon.pl -a insertserverip -p insertserverport -t old insertrconpassword
status > $tf1
   tnl=`wc $tf1 | awk '{print $1}' `

   if [ "$tnl" -le 1 ]; then
   # no. server is really down
   serverpid=`ps auxw | grep serverstartfilenamehere | grep -v grep | awk
'{print $2}'`

   if [ -z "$serverpid" ]; then
   cd /serverstartupfolderhere
   ./serverstartcommandlinehere

   else

   kill $serverpid
      sleep 10
   cd /serverstartupfolderhere
   ./serverstartcommandlinehere

fi
fi
fi
#EOF
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://icculus.org/pipermail/cod/attachments/20060529/38e43ae1/attachment.htm>


More information about the Cod mailing list