LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 04-08-2002, 01:18 PM   #1
phliver
LQ Newbie
 
Registered: Apr 2002
Distribution: slack and gentoo
Posts: 16

Rep: Reputation: 0
automatic reload stopped daemon


i have a dns2go daemon that i need to have running all the time. once in awhile it quits. how would i set it up to atomatically start everytime it stops? somebody once told me to write a script and put it in cron to detect if its running or not but i KNOW there is an easier way. mabie in the startup script?
 
Old 04-09-2002, 03:22 AM   #2
Mik
Senior Member
 
Registered: Dec 2001
Location: The Netherlands
Distribution: Ubuntu
Posts: 1,316

Rep: Reputation: 47
You could run it from the mother of all processes and let it respawn when it dies. Edit the file /etc/inittab and add a line for your process. Something like:

myapp:2345:respawn:/usr/bin/myapp

First field is an id name,
second field is the runlevels (in this case 2 - 5),
third field tells it to respawn it when it dies,
fourth field is the command used to run the process.

You have to make sure you have everything configured properly for that app. Because if it gets an error and dies right away it will try to respawn it. Which can result in the error respawning too fast. Often this will prevent your system from booting. So depending on how important the daemon is, it might be better to use a cron script to make sure it's still running.
 
Old 04-09-2002, 07:09 AM   #3
hanzerik
Member
 
Registered: Jan 2002
Location: Cheyenne Wyoming
Distribution: Debian/Raspbian/Mint
Posts: 717

Rep: Reputation: 32
try this:
crontab -e
add this line:

0 * * * * cd <dir/to/dns2go>; ./dns2go -nice 19 > /dev/null 2> /dev/null

Where <dir/to/dns2go> is the directory where the dns2go executable is installed.
This cron job will attempt to start the program at the top of every hour.
If it is already running, the next invocation will do nothing.
If the program is not running, it will be started.


It works for the setiathome client. Had setiathome running for about 6months straight, before the NIC went out.
 
Old 04-09-2002, 10:07 AM   #4
phliver
LQ Newbie
 
Registered: Apr 2002
Distribution: slack and gentoo
Posts: 16

Original Poster
Rep: Reputation: 0
thanks for your help guys, the inittab sounds like what i was looking for, but at least i was pointed in the right direction, so i can do more research on both cron and inittab.
 
  


Reply



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
how to reload linux? zacherfamily Linux - Newbie 1 09-06-2005 10:50 PM
reload rh9 bobby_hawk Linux - Software 1 05-28-2005 09:07 AM
Cannot Write to Partition - Trying reload texmansru47 Linux - General 2 11-23-2004 11:28 AM
PCMCIA reload MattLaw Linux - Laptop and Netbook 3 09-04-2003 05:44 AM
adsl down reload by itselve ? saavik Linux - Networking 9 05-09-2003 10:51 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 03:03 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