Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 9 Nov 2003 09:39:40 -0700 (MST)
From:      <escapedturkey@escapedturkey.com>
To:        <ports@FreeBSD.org>
Subject:   KKrcon should be in ports =)
Message-ID:  <4595.4.8.14.76.1068395980.squirrel@www.escapedturkey.com>

next in thread | raw e-mail | index | archive | help
It's a great utility for game hosts like myself, who run game servers. I
use it all the time for scripts.

http://kkrcon.sourceforge.net/

To get it working properly, the following files must be placed in the
following locations:

/usr/libdata/perl/5.00503/KKrcon.pm

/usr/bin/kkrcon.pl

I use the following script, for example, checks server status every 10
minutes:

#!/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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4595.4.8.14.76.1068395980.squirrel>