Till Maas <opensource(a)till.name> writes:
> | kill(pid, SIGTERM); /* wait for timeout/sigchld */ kill(pid,
SIGKILL);
Imho there is some code missing, that the pid really belongs to the
service,
no; as already written, modern initsystems use non-forking daemons where
such checks are not needed anymore.
e.g. when the service died/crashed and the pid file still exists
pidfiles are ancient hacks not required by modern initsystems anymore.
, a wrong process can be killed here. Also I guess it would be
better
to first try to SIGTERM the all services that should be terminated,
then wait, and then send the SIGKILL instead of waiting for each
process independently.
stop sequence happens in reverted order and can be done in parallel, but
there must by synchronization points (e.g. 'httpd' + 'ftpd' -> sync
->
'udhcpc' -> sync -> 'udevd')
Enrico