Bug#253099: killall.sh: Can kill wrong PID
Thomas Hood wrote:
> On Mon, 2004-06-07 at 15:30, Joey Hess wrote:
> > busybox ps does not support any of the options you used, as far as I can
> > tell.
> > This is the d-i initrd. We don't have start-stop-daemon. I think that
> > running the code and playing with it on the actual d-i system may have
> > better results than mere inspection.
> > (The d-i system doesn't have sleep either, FWIW.)
> I can see that my ignorance of d-i is on display here. :/ So
> ignore my suggestions for improvement. I guess the original code
> should be tweaked so that the PID of the grep process is excluded,
> as Thiemo Seufer suggested.
The following line works in busybox, and matches also the blank in
front of the process name to make mismatches less likely.
ps |grep ' udhcpc\| dhclient\| pump' |grep -v grep |sed 's/[ ]*\([0-9]*\).*/\1/'