Here's how I use crontab to keep a server alive 24/7.
This will check to see if the process is alive, every 10 minutes, if it doesn't see the server/process, it restarts the server/process.
This is just for Solidat but I also have it for my Quake 3 server.
You can figure out what I do just by the examples I give - or reply if you have more questions.
Start Command
crontab start.cron <-- starts file for crontab entries.
Other Commands
crontab -l <-- to list crontab entries.
crontab -r <-- to empty crontab entries
Contents Of Files
start.cron
*/10 * * * * /home/escapedturkey/startup/soldatchk >/dev/null 2>&1
soldatchk
#!/bin/sh
soldatdir="/home/escapedturkey/soldat/server"
process=`ps auxw | grep soldatserver | grep -v grep | awk '{print $11}'`
if [ -z "$process" ]; then
cd "$soldatdir"
/home/escapedturkey/soldat/server/soldatserver soldatsplenda
fi
This will check to see if the process is alive, every 10 minutes, if it doesn't see the server/process, it restarts the server/process.
This is just for Solidat but I also have it for my Quake 3 server.
You can figure out what I do just by the examples I give - or reply if you have more questions.
Start Command
crontab start.cron <-- starts file for crontab entries.
Other Commands
crontab -l <-- to list crontab entries.
crontab -r <-- to empty crontab entries
Contents Of Files
start.cron
*/10 * * * * /home/escapedturkey/startup/soldatchk >/dev/null 2>&1
soldatchk
#!/bin/sh
soldatdir="/home/escapedturkey/soldat/server"
process=`ps auxw | grep soldatserver | grep -v grep | awk '{print $11}'`
if [ -z "$process" ]; then
cd "$soldatdir"
/home/escapedturkey/soldat/server/soldatserver soldatsplenda
fi