I'm looking for a standard way or best practice to keep a daemon started by an init.d
shell script alive.
Or even better, is there a way to keep it alive directly from /etc/init.d
?
Specifically, I have a daemon called dtnd with and infinite loop that looks for unexpected ended process, if there are any, the daemon wake up them again. Also, I use the start-stop-daemon tool in order to let the precess by run from a given system user.
I want to run this dtnd daemon from startup. In order to achieve this behavior I created a init.d script that "wraps" the dtnd file using start, stop and status commands.
I have 2 questions that I will like to solve:
Is there a way to achieve keeping alive some process from init.d shell script. Is an standard/best way practice?
It's recommended to keep a process alive with infinite loop? I guess it's better to use some command like
respawn
to achieve that. It's correct?
I know about the existance of the respawn
command. I think that's what I need but I don't understand the workflow between /etc/init.d/
and /etc/init
. Can anyone help me?
Note that I don't have inittab neither upstart (I'm only allowed to use /etc/init
, /etc/init.d
, cron
and system tools as start-stop-daemon
. I mean, only the default tools)
Thank you so much for your time!