Linux - GeneralThis 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.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
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
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
Note: second field denotes which run-level you want the daemon to be active in.
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
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).
Oh,.. and since named is a startup script, you'll need to follow up with "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?