LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Automatic Restart (https://www.linuxquestions.org/questions/linux-general-1/automatic-restart-3541/)

Nezar 06-20-2001 03:51 AM

Automatic Restart
 
I have an certain daemon that sometimes shutdown it self without any reason!
Can I make certain thing to automatically restart this application after it shutdown?
If yes, then how?

Marcel 06-20-2001 04:17 AM

I didn't really understand our post but,
a simple "reboot" in the console will reboot the system.
Are you crashing? Are you sure the deamon reboots?

Danish Usman 06-20-2001 04:40 AM

Automatic Restarting Services
 
Dear

u must write a shell script that monitor your specified service
or deamon either it is running or not if it is stopped then restart it
again and put this script in crown job run it every after 1 minute

Regards


Danish Usman

Nezar 06-21-2001 05:17 AM

Comment !
 
To be precise, the daemon stops it self arbitrarly. How to restart it automatically. (i,e, some controls ....).

hazza96 06-21-2001 06:38 AM

Quote:

To be precise, the daemon stops it self arbitrarly. How to restart it automatically. (i,e, some controls ....).
Which daemon?

Maybe we can help to find out why that particular daemon is stopping. That's the difference between a solution and a workaround.

Maybe the daemon is supposed to stop after a period of time? How are you checking that the daemon is stopped? What distro have you got?

Nezar 06-22-2001 03:17 AM

Hi,

The daemon is NAMED

Thanks,

christopherccv 09-23-2003 10:47 PM

Dear Nezar and Harry,

may i know weather can have have the solution for what have you discuss long time ago regarding the script for the named service to be automatic restart when is fail.

Thanks

Christopher

shawnchin 09-24-2003 01:50 AM

If you want a deamon to restart automatically whenever it dies, you can get the use of our best friend, INIT.

We can do this by adding an entry in /etc/inittab
Just like how your login prompt respawns everytime you're logged out and ended the session, we can use the respawn directive to respawn any daemon that dies.

Use and entry as such
# in /etc/inittab
c1:345:respawn:/path/to/my/daemon


Note: second field denotes which run-level you want the daemon to be active in.


Cheers

christopherccv 09-24-2003 02:05 AM

Dear Shawnchin

thanks for your reply.

the c1 stand for the tty is it? by default one should be 1. mean i can put from 1 to 5. correct?

what i should have is :

1:2345:respawn:/etc/init.d/named

is this correct?

shawnchin 09-24-2003 02:20 AM

c1, or the first field to be exact, is for ID. Just a unique identifier for that entry. Not associated to any TTY, unless you are running a Login Process, for which u put in the related TTY (required for login accounting).

From man inittab
Quote:

id is a unique sequence of 1-4 characters which identifies an entry in inittab (for versions of sysvinit compiled with libraries < 5.2.18 or a.out libraries the limit is 2 characters).

shawnchin 09-24-2003 02:24 AM

Oh,.. and since named is a startup script, you'll need to follow up with "start":
/etc/init.d/named start

respawning thru INIT is usually used for daemons that are not called thru the start-stop daemon (like some installations of Oracle), so i'm not too sure if it will work for named, but you could give it a try i guess.


Perhaps a more permanent solution would be to figure out why your named shuts down for no particular reason, and fix that instead?

christopherccv 09-24-2003 03:21 AM

thanks for your reply. i will test it out.

i still looking into the problem why the named service keep on fail when it run quite some time.

thank you


All times are GMT -5. The time now is 05:06 AM.