LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 06-11-2004, 03:55 PM   #1
lucasbl3
LQ Newbie
 
Registered: Feb 2004
Posts: 8

Rep: Reputation: 0
Post How to automatically respawn a process?


Hello guys, I am having a process which must be always online. That is, if it goes down it must be respawned as soon it is possible.
How can you accomplish this?
Iīve heard that you could do this with the inittab but apparently you canīt have much control over the respawning period. I am right about this? Could you alter this period?

Thanks a lot.
 
Old 06-11-2004, 04:02 PM   #2
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 64
Take a look at Daemontools:
http://cr.yp.to/daemontools.html
 
Old 06-11-2004, 04:29 PM   #3
phlogistonjohn
LQ Newbie
 
Registered: Jul 2003
Location: MA, USA
Distribution: Mandrake,Debian,Zaurus
Posts: 17

Rep: Reputation: 0
A very simple way of doing it would be with a shell script in an infinite loop.

An example would be if your daemon was called foo, I'd write a script called run-foo.sh.

the contents would hold:

Code:
#!/bin/sh
while true; do foo "$@"; done

so evertime the "foo" process dies, "run-foo.sh" begins to execute again and then starts foo back up.

There are probably bunches of other ways to do it too.
 
  


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 On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to create a bash script to automatically disown a process. jon_k Linux - Software 5 06-19-2005 06:53 AM
CRON Process Won't Execute Automatically Transition Linux - General 5 01-14-2005 04:51 PM
If I want, that process has automatically started at system loading or reloading ukrainet Linux - Newbie 2 12-14-2004 10:39 AM
automatically starting process in Fedora Core 2 by using script falkesgaard Programming 1 07-29-2004 11:11 AM
process is getting killed automatically chens_83 Linux - General 2 09-16-2002 04:52 AM


All times are GMT -5. The time now is 07:16 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration