Your skill will accomplish what the force of many cannot |
|
PerlMonks |
Re^3: perl alarms not working as expectedby betterworld (Curate) |
on Oct 16, 2012 at 17:20 UTC ( [id://999385]=note: print w/replies, xml ) | Need Help?? |
The signal handler is that sub{} that you stored in $SIG{ALRM}. To kill the other script, you'd have to get its pid. Unfortunately I don't know any way to this without any ugly hacks. Maybe someone else does. So for instance, you can use this temporary file handle hack:
This requires the "fuser" command, which is shipped with most Linux distros. If this does not make the other script die, then leave out the "-TERM". I replaced the name of your shell script with "sleep 10", otherwise I can't test it. I also replaced 20 with 3 because I did not want to wait 20 seconds.
In Section
Seekers of Perl Wisdom
|
|