initscript: Do I have to wait for a service to stop?

Richard W.M. Jones rjones at redhat.com
Mon Jan 17 12:55:55 UTC 2011


I'm trying to fix a bug:
https://bugzilla.redhat.com/523391
initscript collected problems LSB-compilant watchdog

It's all fairly straightforward except for the 'watchdog stop'
operation.

Now when you send a signal to the watchdog daemon, it can take several
seconds to shut down.  The usual 'killproc' function would handle this
by sending a SIGTERM, waiting a few seconds, then sending a SIGKILL.

However for the Linux watchdog API, this is a very bad idea: if you
kill the daemon before it has properly cleaned up, then it might not
have "disarmed" the watchdog, with the result that your machine could
suddenly hard reboot some seconds later.  Oops.

We don't want that so we use 'killproc -TERM' which disables the
waiting bit and the final SIGKILL.  The watchdog daemon is pretty
well-behaved and does eventually terminate[1].

Because the watchdog hasn't shut down when the init script returns,
the LSB script test for this fails.

So I don't know how to fix that one.  Any suggestions?

Rich.

[1] Note: After an arbitrarily long time .. it could be in the middle
of running an external user-supplied test script at the time.  The
upper bound on these is the watchdog timeout, which is configurable
and determined by a combination of the conf file, the device driver,
and the hardware itself.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-top is 'top' for virtual machines.  Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://et.redhat.com/~rjones/virt-top


More information about the devel mailing list