Can I rely absolutely on what happens when a process dies.
Bob Dunlop
bob.dunlop at xyzzy.org.uk
Thu Dec 9 08:58:14 UTC 2010
On Wed, Dec 08 at 12:22, Johannes Stezenbach wrote:
> On Tue, Dec 07, 2010 at 11:43:53AM +0000, Bob Dunlop wrote:
> > > Pid files are not very robust in general.
> >
> > You can make you kill script a bit more robust with a simple check. Get
> > the pid from the file and examine "/proc/<pid>/cmdline" which should
> > contain the name of the dhcp process as the first null terminated string.
> > You can't use "/proc/<pid>/exe" for this because that will just be
> > pointing at busybox. If the name matches you're on to a reasonable bet
> > that you are killing the right thing.
>
> start_stop_daemon already implements that, right?
Yep --exec used with --stop and --pidfile. A good call if you are actually
doing the kill from within a script.
Most of the time I'm working in C so calling an external binary is a pain,
we don't even have start_stop_daemon enabled on our system.
--
Bob Dunlop
More information about the busybox
mailing list