<p>Actually, the processes are very long lived. So the rework will involve either a tee or a subshell so the main process can watch trhe sub and kill it after a max time elapses. Clearly not going to work as briefly demo'd in original post. Many thanks to all for making me rethink this.</p>
<p><blockquote type="cite">On Mar 24, 2010 5:05 PM, "Ed Cashin" <<a href="mailto:ecashin@noserose.net">ecashin@noserose.net</a>> wrote:<br><br>You can use backgrounded processes and "wait" as shown below.<br>
Otherwise, the process has exited before your script gets control again,<br>
making the pid unusable. Or I'm missing the point. :)<br>
<br>
In this example the alarm going off represents some condition like<br>
the foreseen "probable kill needs".<br>
<br>
me=$$<br>
sh -c "sleep 5 && kill -USR1 $me" & # alarm in 5 seconds<br>
sleep 20 &<br>
job=$!<br>
trap "echo kill $job" USR1<br>
wait $job || echo "aborted pid $job" 2>&1<br>
<br>
--<br>
Ed Cashin <<a href="mailto:ecashin@noserose.net">ecashin@noserose.net</a>><br>
<a href="http://noserose.net/e/" target="_blank">http://noserose.net/e/</a><br>
<a href="http://www.coraid.com/" target="_blank">http://www.coraid.com/</a><br>
_______________________________________________<br>
Ale mailing list<br>
<a href="mailto:Ale@ale.org">Ale@ale.org</a><br>
<a href="http://mail.ale.org/mailman/listinfo/ale" target="_blank">http://mail.ale.org/mailman/listinfo/ale</a><br>
See JOBS, ANNOUNCE and SCHOOLS lists at<br>
<a href="http://mail.ale.org/mailman/listinfo" target="_blank">http://mail.ale.org/mailman/listinfo</a><br>
</blockquote></p>