[PATCH 2/2] start-stop-daemon - find processes better

Joakim Tjernlund joakim.tjernlund at transmode.se
Wed Apr 30 15:25:10 UTC 2008


On Wed, 2008-04-30 at 15:27 +0100, Roy Marples wrote:
> On Wednesday 30 April 2008 14:37:31 Denys Vlasenko wrote:
> > On Wednesday 30 April 2008 13:40, Joakim Tjernlund wrote:
> > > On Wed, 2008-04-30 at 12:18 +0100, Roy Marples wrote:
> > > > start-stop-daemon uses stat to match running binaries.
> > > > This is not good as the binary in question could be moved or deleted
> > > > during an upgrade.
> >
> > When it is moved or deleted, and replaced by a new file with the same name,
> > is this the same binary or not?
> >
> > I bet if you do a poll, results will be split about 50:50.
> 
> But the intent of start-stop-daemon is to start and stop daemons.
> s-s-d --stop --exec /usr/sbin/ntpd
> I would that expect it to stop the currently running ntpd process regardless 
> of if the binary itself still exists or not.

Don't think so, this is what --name is for. At least I think so.

> 
> > > It
> > > wont work when cmdline i a symlink. Should you not use --name instead
> > > to handle the deleted case?
> 
> But this is good :)
> Consider busybox - loads of things symlink into it, like udhcpd. So are you 
> stopping udhcpd or all instances of busybox daemons?

You won't stop anything with your solution because /proc/xxx/exe
contains the real file name. So 
  s-s-d --stop --exec /bin/mysymlinkeddaemon
will not match.

  Jocke



More information about the busybox mailing list