linux service daemon

linux service daemon

Amos Shapira amos.shapira at gmail.com
Tue Feb 17 19:07:58 IST 2009


2009/2/18 BIRAN, Yahav (Yahav) <biran at alcatel-lucent.com>:
> [Yahav Biran] the application is running on RH AS 5. its is a java process (activemq 5.2.0).
> Im trying to have a running daemon that is starting and stopping automatically (this is already achieved) the problem is when the process is aborted in unlikely event. In that case I would expect the daemon will be started automatically.

(please try to clip your lines to ~75 chars).

So you manage to start the daemon but you want some watch-dog to
restart it when it fails?

That's not something you usually put in the init startup script itself.

I'd suggest that you either use monit (http://mmonit.com/monit/,
available as a package from RPMForge) or have a wrapper parent process
inside bin/amq which would be a simple shell or perl script to re-run
the java process in a loop whenever it exits with a signal. You'll
have to kill that wrapper process before the child it watches when you
actually take things down to avoid it from restart the child.

I'm not sure how to get the details of a child exit signal from the
shell so I'd consider using perl (perl's $? is much more comprehansive
that the shell's $?).

Also consider redirecting standard input from /dev/null (</dev/null)
to completely detach your process from any controlling terminals.

--Amos



More information about the Linux-il mailing list