Re: start-stop-daemon : strange behavior
Just to follow myself,
On Mon, May 29, 2000 at 04:51:07PM +0200, Thierry Laronde wrote:
> [I have set the reply to --- I'm not subscribed at the moment to
> After investigating, I found that, in the /etc/init.d/sendmail script,
> the problem was this condition (in the stop() function) :
> if $STOP_CMD --quiet ; then
> where $STOP_CMD is :
> STOP_CMD="start-stop-daemon \
> --pidfile $PIDFILE \
> Actually, start-stop-daemon, in contradiction with what is said in the
> man pages, when invoked when the processus is _not_ running, return with
> 0, whether you specify --oknodo or not. Thus, the condition is always
> true, and the script loops for 120 secondes.
The behavior is definitively strange, because it's a bit random. On my
two PCs, start-stop-daemon always returns 0 if it can't kill a process.
But when it returns 1, that's _not_ because it can kill the process, but
because it can't open the pidfile. So the 1 return is only a side
effect, and the fact is that some pidfiles are deleted when the process
are killed, and some not.
For example, if I invoke start-stop-daemon --pidfile atd.pid --stop, the
process is stopped AND the pidfile is removed (but with strace, it seems
that this is not a direct action of start-stop-daemon). But with
sendmail.pid, the pidfile is not removed, so the second call of
start-stop-daemon failed (unable to kill the process), but returns 0.
Thierry LARONDE <firstname.lastname@example.org>
10, rue du Bel Air, 74000 ANNECY / Tel.-Fax : 33.(0)126.96.36.199.61
website : http://www.polynum.com
/home du SDF (Site Debian Francophone) : http://www.polynum.com/debian/