How accurate do you want the delay to be? If you embed a 1 hour delay in the loop along with the commands that are being run, your script will run every 1 hour + however long the commands take, so your schedule will slip continuously. A slightly different formulation of the loop will account for that without having to accurately time how long the commands take:
my $endTime = time() + 3600; while( 1 ) { # Do stuff, # Do more stuff # And more # And more # And more # And more sleep 1 while time() < $endtime; $endtime = time() + 3600; }
The inner sleep loop will consume negligible cpu but will ensure that you don't sleep longer than you need to, even if the active part of the script varies in how long it takes to run.
In reply to Re: Pause Loop
by BrowserUk
in thread Pause Loop
by pyro.699
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |