Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

Re: Script to poll every hour

by kennethk (Abbot)
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.

Replies are listed 'Best First'.
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?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1045188]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (6)
As of 2018-06-22 19:48 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (124 votes). Check out past polls.