[Eug-lug] Shell script question

larry price laprice at gmail.com
Tue Aug 1 19:51:38 PDT 2006


Or use

killall -g $(head -1 /var/run/foo.pid)

after saving the pid as quentin describes.

note: killall varies considerably from platform to platform
check your man page


On 8/1/06, Quentin Hartman <qhartman at gmail.com> wrote:
> On 8/1/06, Quentin Hartman <qhartman at gmail.com> wrote:
> > I seem to remember some bash convention that would allow the behavior
> > you are looking for, but I can't recall exactly what it is. I'm likely
> > dreaming. My suggestion would be to track the PIDs of the processes
> > you spawn, which I believe can be done by examining the !$ environment
> > variable after launching each process, and then killing them
> > explicitly. I've not had a need to do this myself though, so you'll
> > have to look elsewhere for specific recommendations on how precisely
> > this might be done.
>
> oops, here's a better idea. Record the PID of the script using $$, and
> the in your time killer, use that to call "ps --ppid $saved_pid" which
> will return the PID's of all the children of your script. A little awk
> slicing and you can kill them each directly.
>
> --
> -Regards-
>
> -Quentin Hartman-
> _______________________________________________
> EUGLUG mailing list
> euglug at euglug.org
> http://www.euglug.org/mailman/listinfo/euglug
>


More information about the EUGLUG mailing list