Linux – start-stop-daemon saves wrong PID

daemondebianinit.dlinux

$ ps aux | grep svn
root      **4458** ... /usr/bin/svnserve -d -r /var/svn
manuel    4466 ... grep --color=auto svn
$ sudo kill **4458**
$ sudo rm /var/run/svnserve.pid
$ sudo start-stop-daemon --start --make-pidfile --pidfile /var/run/svnserve.pid --exec /usr/bin/svnserve -- -d -r /var/svn
$ cat /var/run/svnserve.pid
**4474**
$ ps aux | grep svn
root     **4477**  ... /usr/bin/svnserve -d -r /var/svn
manuel    4480     ... grep --color=auto svn

Why is start-stop-daemon saving wrong pids?

Best Answer

You used the -d flag in svnserve, which means that svnserve forks, and child processes will have different pids, than the parent svnserve process.

start-stop-daemon doesn't know about child process pids.

Suggestion:

  • Use pid-file from svnserve to determine pid number (And remove the make-pidfile argument.)
  • Disable forking in svnserve, and configure start-stop-daemon to do this as well (there is an example on the bottom of manpage)