Auto Restart scripts for apps
I know this is a newb question. I just started really messing around with Linux and all it's wonders.
If this is in the wrong section I'm very sorry about it.
What I'm trying to do is setup and auto restart script for two game servers that just love to crash on me.
What I have done so far is made a .sh file and used crontab -e to put it into cron to run every 10 mins.
From what I know it still doesn't work so I know my scipts are wrong in some way or just the maner in which I did it. Like I said this all very new to me so I'm even 50% sure I'm doing it correctly.
I know how to find the processor ID, but is there any way how to make linux just look for that one process?
"bf2restart.sh"
-------------------------------
#!/home/bash
bf2dir="/home/devilscss/bf21/bf2"
bf2_f=`ps auxw | grep bf2_f | grep -v grep | awk '{print $11}'`
if [ -z "$bf2_f" ]; then
echo "Couldn't find bf2 demo running, restarting it."
cd "$bf2dir"
nohup screen -A -m -d $user ./start.sh &
echo ""
f
-----------------------------
crontab -e
How I did this was I press "a" to insert new line, put two spaces at the end and went to new line, went back to command line and typed in ":wq" to save and exit.
--------------------------------------------------
*/10 * * * * /home/devilscss/bf21/bf2start.sh >/dev/null 2>&1
----------------------------------------------
|