View Single Post
Old 05-23-2002, 02:05 AM   #62
willum
 
Join Date: May 2002
Posts: 13
I have a script I use which is pretty simple. I run this script from the user willum. i call it restart.sh
--------------------------------------------------------------------
#!/bin/bash
willumpid() {
/usr/sbin/lsof -i UDP:$1 -F '' | cut -f 1-
}
pid=`willumpid 27960`
if [ -z "$pid" ];
then
/home/willum/server.sh
fi

--------------------------------------------------------------------
if the server is down it executes my startup script server.sh
------------------------------------------------------------------------
#!/bin/sh

echo Starting up JK2 dedicated server: CTF

cd /home/willum/jk2

screen -A -m -d -S JK2 ./jk2ded +set com_hunkmegs 128 +set dedicated 2 +set sv_pure 1 +sets gamestartup \"`date
+"%m-%d-%y %T"`\" +set ttycon 0 +set net_ip 207.19.97.119 +set net_port 27960 +exec jk2ctf.cfg &
--------------------------------------------------------------------------------
then i have crontab check every 5 mins if the port is open
------------------------------------------------------------------------
*/5 * * * * /home/willum/restart.sh

-----------------------------------------------------------------
hope this helps!


willum is offline   you may: quote & reply,