Why might might_hang.pl hang? Perhaps the problem can be fixed there
without using alarms, particularly if the hang is due to a network
resource.
Otherwise, you can start a watchdog process that will kill might_hang.pl
after 300 seconds. Here's a bash shell script that will do it for you: http://www.shelldorado.com/scripts/cmds/timeout.txt
- Mark.
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Arijit Das
Sent: Monday, March 13, 2006 8:30 AM
To: perl-unix-users@listserv.activestate.com; activeperl@listserv.activestate.com
Subject: [Perl-unix-users] Timeing Out a Command - how to?Is there any way to time out a unix command?Its something like this... I want my PerlPgm <might_hang.pl> to be killed by the shell (sh/bash/csh) if my PerlPgm fails to finish off by 300 elapsed seconds.Something like<timeout_shell_command> -timeout 300 might_hang.plThis should execute might_hang.pl normally but if might_hang.pl fails to finish off by 300 elapsed secs, it should kill the might_hang.pl process.I know that this can be achieved from inside might_hang.pl using alarms, but I needed to achieve that through a bourne shell i.e. the invoker of the Perl program (might_hang.pl).Any thoughts about how this can be achieved...?Thanks,Arijit
Yahoo! Mail
Bring photos to life! New PhotoMail makes sharing a breeze.
_______________________________________________ Perl-Unix-Users mailing list Perl-Unix-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs