Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Script to poll every hour

by kennethk (Monsignor)
on Jul 18, 2013 at 20:44 UTC ( #1045188=note: print w/ replies, xml ) Need Help??


in reply to Script to poll every hour

This sounds more like something that should be solved via a cron job, particularly since it sounds like something that should be persistent. The Windows equivalent is using the scheduler, which is found via

Start > Programs > Accessories > System Tools > Task Scheduler
or something like that, depending on your version.

That is, of course, not the question you asked.

To run a script and then pause it until 20 past the hour, you should use localtime to get the minutes (my $min = (localtime)[1];) and then sleep 60 * the mod of the difference between that and the target (sleep(60 * ((20 - $min) % 60))). If you need better precision, you can include seconds (or even milliseconds) in that calculation.


#11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.


Comment on Re: Script to poll every hour
Select or Download Code
Re^2: Script to poll every hour
by sidsinha (Acolyte) on Jul 22, 2013 at 00:19 UTC
    Thankyou Sir, exactly what I wanted!!

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1045188]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (8)
As of 2014-12-29 15:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (192 votes), past polls