[kwlug-disc] Parent Processes

Colin Mackay zixiekat at gmail.com
Tue Jan 25 12:13:33 EST 2011


Greetings,

I've been wrestling to find the parent process of perl scripts that are left
running after exiting from the parent shell.  Specifically it is a search
script that is started like this:

nohup search.pl -o output.txt -p <pattern> &

Following this, I exit the shell.  From another shell, running pstree, I can
see:

search.pl, 12345 ....
    |--search.pl, 12346 ....
    |--search.pl, 12347

...up to about 20 times, which is how the script runs.

But if more than one search is running, I of course see this twice, with
different pids.

search.pl, 12345 ....
    |--search.pl, 12346 ....
    |--search.pl, 12347....

search.pl, 3454 ....
    |--search.pl, 3455 ....
    |--search.pl, 3456....


What I'd like to find, with a bash script, is the parent process to these.
It's easy to type in pstree, but I'd like the pid as a variable, but I'm
having a hard time figuring out a shell command that will help me find
these...


Any ideas out there?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://kwlug.org/pipermail/kwlug-disc_kwlug.org/attachments/20110125/91b8cf15/attachment.htm>


More information about the kwlug-disc mailing list