linux service daemon

linux service daemon

Amos Shapira amos.shapira at gmail.com
Wed Feb 18 13:55:34 IST 2009


2009/2/18 Biran, Yahav (Yahav) <yahav.biran at gmail.com>:
>  [Yahav Biran] BTW why not setting amq to start from by init
> (configure it in /etc/inittab in respawn mode). Is it good practice?
> I saw that cron is configure like that.

Yes you can add a line to inittab with a "respawn" action.

It's not a very common way to do things and from looking at
/etc/inittab on one of our CentOS 5.2 servers I don't see that cron is
started there, it's started through the more common /etc/init.d
scripts (see "chkconfig --list crond").

The advantage that I see in having a separate script in /etc/init.d
and friends is that it's much easier to manipulate - it doesn't
require editing of a monolithic file and there are very nice tools to
manipulate these directories on CentOS/RHEL (chkconfig, service - I
wish these tools would be more standard across the Linux distro
landscape).

Also a separate script is more portable - It can be used stand-alone
on systems which don't support the infrastructure (e.g. ubuntu totally
got rid of /etc/inittab in favor of /etc/event.d directory) or other
contexts (e.g. running the script as a resource of Linux-HA, we just
link them or drop them in /etc/ha.d/resources.d).

So in the name of long-term maintainability, I'd suggest you consider
working on some way to embed a watchdog mechanism in the script (and
by "watchdog" I mean a parent process which will automatically get
notified when its child crashes).

> I want to avoid installing 3rd party S/W for such basic task.

Yes, I can see the weakness of such dependency, though monit
specifically is a very basic tool which can be used on any reasonable
platform.

--Amos



More information about the Linux-il mailing list