[Eug-lug] Shell script question

Quentin Hartman qhartman at gmail.com
Tue Aug 1 18:37:45 PDT 2006


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-


More information about the EUGLUG mailing list