LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 10-14-2004, 06:18 PM   #1
odysseynetwork
LQ Newbie
 
Registered: Oct 2004
Posts: 5

Rep: Reputation: 0
script


I need a program or script that will make sure another program is running. I need it to check hourly, and start the other program if it's not running.
Any ideas on how I can do this?
Thanks
James
 
Old 10-14-2004, 07:02 PM   #2
whansard
Senior Member
 
Registered: Dec 2002
Location: Mosquitoville
Distribution: RH 6.2, Gen2, Knoppix,arch, bodhi, studio, suse, mint
Posts: 3,306

Rep: Reputation: 66
cron is your friend.
 
Old 10-14-2004, 07:02 PM   #3
CroMagnon
Member
 
Registered: Sep 2004
Location: New Zealand
Distribution: Debian
Posts: 900

Rep: Reputation: 33
Check out daemontools http://cr.yp.to/daemontools.html. This is exactly what you're after, though it can be a little difficult to set up exactly right.
 
Old 10-14-2004, 07:13 PM   #4
neo77777
LQ Addict
 
Registered: Dec 2001
Location: Brooklyn, NY
Distribution: *NIX
Posts: 3,704

Rep: Reputation: 56
a very simple script would be
like this - I made it very simple to check for syslog (/usr/bin/start_syslog is a fictious program)
Code:
#!/bin/sh
ps -ef|grep [s]yslog > /dev/null 2>&1
STATUS=$?
if [ $STATUS = 0 ]
then
        echo "STATUS $STATUS success"
else
        echo "Syslog is not running $STATUS"
        /usr/bin/start_syslog
fi
You can put the script into a crontab. The entry will look like this to have it run every hour at 15 minutes after the hour:
15 * * * * /path/to/sysloger_checker.sh 1>/dev/null

Good luck,
I hope it is not homework I am doing for you .
 
Old 10-15-2004, 08:23 AM   #5
odysseynetwork
LQ Newbie
 
Registered: Oct 2004
Posts: 5

Original Poster
Rep: Reputation: 0
Thanks for the help,
and no, it's not homework.
Thanks again,
James
 
  


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
Iptables (with masq) troubleshooting, very simple script attached script and logs. xinu Linux - Networking 13 11-01-2007 04:19 AM
Directory listing - Calling shell script from a CGI script seran Programming 6 08-11-2005 11:08 PM
creating shell script that executes as root regardless of who runs the script? m3kgt Linux - General 13 06-04-2004 10:23 PM
send automatic input to a script called by another script in bash programming jorgecab Programming 2 04-01-2004 12:20 AM
linux 9 and java script error - premature end of script header sibil Linux - Newbie 0 01-06-2004 04:21 PM

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

All times are GMT -5. The time now is 09:28 AM.

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