Help answer threads with 0 replies.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 10-31-2006, 04:34 PM   #1
LQ Newbie
Registered: Aug 2005
Posts: 18

Rep: Reputation: 0
need help to write script to check the process health and automatically restart it

I write a small program, which need to constantly be watched, and check its status, if it was dead, it should be restart automatically.
Please kindly refer me to URL which teach how to write this kind of script, or service.
Old 10-31-2006, 04:52 PM   #2
LQ Veteran
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 13,845

Rep: Reputation: 1453Reputation: 1453Reputation: 1453Reputation: 1453Reputation: 1453Reputation: 1453Reputation: 1453Reputation: 1453Reputation: 1453Reputation: 1453
maybe have a look at monit
Old 11-01-2006, 10:13 AM   #3
LQ Newbie
Registered: Aug 2005
Posts: 18

Original Poster
Rep: Reputation: 0
will have back up and look for non-GUI tool or just script template

Thanks for your advice.
I am looking for a non-GUI tool or at best, just a script, may be a script template.
Thanks again.
Old 11-01-2006, 01:23 PM   #4
Registered: Mar 2004
Distribution: CentOS 4.3/4.5
Posts: 72

Rep: Reputation: 15
Here is a script that will look for a process called Test every second and if it is stopped for some reason will restart it. Something like this may work for you.

while true;
PROCESS='ps -A | grep Test'
if [ "$PROCESS" = "" ]
./Test &
sleep 1


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
Script to check connection (and restart network if down) mac_phil Linux - Networking 10 01-06-2010 06:19 AM
Health Check / Server Completion Check Software? tells Linux - Enterprise 0 04-20-2006 12:03 PM
write a script to automatically post to a blog??? Hosiah Linux - General 11 10-14-2005 12:30 PM
How to create a bash script to automatically disown a process. jon_k Linux - Software 5 06-19-2005 06:53 AM
automatically starting process in Fedora Core 2 by using script falkesgaard Programming 1 07-29-2004 11:11 AM

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

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