There's more than one way to do things | |
PerlMonks |
Re: Perl script to run for x hoursby marinersk (Priest) |
on Sep 28, 2016 at 02:45 UTC ( [id://1172790]=note: print w/replies, xml ) | Need Help?? |
As noted by others, what the script is doing generally drives the decision on how to implement the time limit. That said, if you have something that can run for hours, one hopes it is doing some menial task inside a loop. The most graceful (but to Happy-the-monk's point, not necessarily the most timely) approach, in my opinion, is to grab the time at the start of the loop, precompute the ending time, and then check current time at the top of the loop and see if we've passed the deadline. Something like this:
In Section
Seekers of Perl Wisdom
|
|