-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

sorry for the delayed answer.

Steinar H. Gunderson schrieb:
> The only code path that _doesn't_ work is when there is a pid file but the
> web server does not run.
Ah, now I understand. My "|| true" proposal was wrong anyway, as Steve
and Stephen have pointed out.
The real issue is a stale .pid file (and the init.d script failing in
this case):
$ apt-get install thttpd
[...]
Updating rc.d symbolic links to start thttpd upon booting.
Starting thttpd ...

Now the pid file is written...
$ cat /var/run/thttpd.pid
23820

... but the daemon is not started:
$ ps waux | grep 23820 | grep -v grep

I suspect this is because thttpd wants to start on port 80, which is
already used by my local apache installation. The log file however is empty:
$ ls -l /var/log/thttpd.log
- -rw-r--r-- 1 root root 0 2006-08-28 20:25 /var/log/thttpd.log

Now stopping fails, and subsequently the prerm script
$ /etc/init.d/thttpd stop; echo $?
Stopping web server: /etc/init.d/thttpd: line 35: kill: (23820) - Kein
passender
 Prozess gefunden
1
$ env LANG=C apt-get remove --purge thttpd
[...]
Removing thttpd ...
Stopping web server: /etc/init.d/thttpd: line 35: kill: (23820) - No
such proces
s
dpkg: error processing thttpd (--purge):
 subprocess pre-removal script returned error exit status 1
Errors were encountered while processing:
 thttpd
E: Sub-process /usr/bin/dpkg returned an error code (1)

> This could surely be improved (the start target
> can't handle it either), but it surely isn't RC.
I just installed thttpd, and then the removal failed, so I think the
serious severity is justified by that.
The init.d script should detect a stale thttpd.pid file, and just
remove it. Something like this should work:
FPID=/var/run/thttpd.pid
if [ -f $FPID ]; then
  PID=`cat $FPID`
  if ps | grep -q "^$PID"; then
    kill -10 $PID
  else
    echo "Removing stale PID file $FPID"
  fi
  rm -f $FPID
fi

The other question is why a stale .pid file was written in the first
place. I expected in the log file to see something like "could not bind
to port 80" or similar. Perhaps it is worth to have a separate bug for that?

Regards,
  Bastian
- --
  ,''`.                  Bastian Kleineidam
 : :' :                    GnuPG Schlüssel
 `. `'    gpg --keyserver wwwkeys.pgp.net --recv-keys 32EC6F3E
   `-

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFE/adOeBwlBDLsbz4RAii6AKCZN+HxpiyTxYDQSRGkRuZ/mJfMowCff3mc
HMcSwZ0+Cj6yt4laaQYo/mA=
=A4sI
-----END PGP SIGNATURE-----

Reply via email to