r00d Posted April 1, 2002 Share Posted April 1, 2002 Linux Outcast Server Monitor Tool © NTF I whipped up a little script that will check to make sure outcast server is running, and if it's not, it will restart it. This script should be run every (1) minute by CRON. #!/bin/sh # # Jedi Knight II: Jedi Outcast Linux Server Monitor # Portions of code borrowed from the IRC Proxy BNC monitor file # Original Code by NTF Copyright © 2002 Taylor Digital Technologies # Group, Inc. # # Brought to you by [OWN] Clan. http://www.ownclan.com # limited support available: ntf@ownclan.com # # You'll need the PIDOF utility by Miquel van Smoorenburg # for Linux for this to work, or else find another # way to write the pid of the server to the jk2ded.pid file # PIDOF is standard in many linux distributions. # # Run this script as a cron job, and it will check to make sure your server # is up and running. If it finds the server down, it will restart it. # # License is granted to use, distribute, and modify this file, as long # as you include the credits and copyright notices. # # # Modify the next 3 lines to indicate your settings # JKBIN=jk2ded JKSTARTFILE=start_server JKPIDFILE=jk2ded.pid JKPATH=/usr/local/games/jk2/ # # There should be no need to modify any of this # cd $JKPATH pidof $JKBIN > $JKPIDFILE cd $JKPATH if test -r $JKPATH/$JKPIDFILE; then JKPID=$(cat $JKPATH/$JKPIDFILE) if $(kill -CHLD $JKPID >/dev/null 2>&1) then exit 0 fi echo "" echo "Stale pid file (erasing it)" rm -f $JKPATH/$JKPIDFILE fi echo "" echo "JK2 Server down, restarting." echo "" if test -x $JKSTARTFILE ;then $JKPATH/$JKSTARTFILE exit 0 fi echo "Could not restart." Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.