KKrcon should be in ports =)

escapedturkey at escapedturkey.com escapedturkey at escapedturkey.com
Sun Nov 9 08:39:43 PST 2003


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




More information about the freebsd-ports mailing list