Patrick R. Wade wrote:
A shell script runs a for loop iterating a command:
#!/bin/sh
# foo.sh ; an example script
for i in foo bar baz
do find /home/$i
done
exit 0
If we run this and observe top, we will see three processes; one for
foo.sh, another for a child foo.sh (the for loop) and one for find.
If i send a kill to the parent foo.sh process, the child foo.sh and find
jobs will continue running. This, from what i gather, is normal *NIX
behavior. My objective, however, is to ensure that foo.sh exits by a
certain time, so i have an at job waiting to send it a kill. Is there
an idiom when writing the script to ensure that the kill it receives
will kill the child processes as well? Is there a completely different
approach i need to take when the design requirement of termination by a
time certain is added? Exhortations to learn Python are perhaps apropos
but useless in the short term.
Patrick R. Wade
Look into both killall, and fuser, and see if either of those two will
help you. YMMV
Regard
Fred James
_______________________________________________
EUGLUG mailing list
[email protected]
http://www.euglug.org/mailman/listinfo/euglug