LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 06-19-2005, 03:29 AM   #1
Ghent
LQ Newbie
 
Registered: Jun 2005
Distribution: Fedora 4
Posts: 5

Rep: Reputation: 0
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

----------------------------------------------
 
Old 06-19-2005, 05:43 AM   #2
adnanm
Member
 
Registered: Dec 2004
Location: Bosnia and Herzegowina
Distribution: Centos, FreeBSD
Posts: 49

Rep: Reputation: 15
Try this for you crontab:

*/10 * * * * sh /home/devilscss/bf21/bf2start.sh >/dev/null 2>&1
 
Old 06-19-2005, 08:37 AM   #3
Ghent
LQ Newbie
 
Registered: Jun 2005
Distribution: Fedora 4
Posts: 5

Original Poster
Rep: Reputation: 0
OK found out one major flaw in my .sh file and that is fixed and working properly. Killed the process and ran it and it restarted the app. But I waited 30 min and the cron didn't work. I tried adding "sh" into it as well. And still not a go.

Is there away to make sure that the crontab is actully working properly?

Been up for 28 hours now trying to get it to work properly. Thank god for coffee and smokes.
 
Old 06-20-2005, 07:33 PM   #4
Ghent
LQ Newbie
 
Registered: Jun 2005
Distribution: Fedora 4
Posts: 5

Original Poster
Rep: Reputation: 0
/bump

Anyone have any idea what could be causing it to not full work? Do I need to be loged in as root.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Service to auto restart jamiehenderson Linux - Software 3 08-08-2005 02:44 PM
Auto Restart HiJack Fedora 2 07-27-2005 12:38 PM
auto restart service st3reo Linux - Newbie 4 12-07-2004 01:46 PM
Auto-login and auto-restart... TankerKevo Red Hat 2 10-04-2003 08:52 AM
restart scripts.. aliensub Slackware 1 07-19-2002 06:29 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 04:08 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration