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

Re: Perl Cron Daemon

by zek152 (Pilgrim)
on Jun 02, 2011 at 14:58 UTC ( [id://907813]=note: print w/replies, xml ) Need Help??


in reply to Perl Cron Daemon

The code below will print "Event @ $sec" if the time is either :00 or :01. I don't know how taxing it is on the computer. I think that sleep does an alarm + pause call so it shouldn't be spin waiting. The reason for the sleep(30); is so that there is an additional time to correct for error due to sleep(.).

while(1) { ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime( +); if($sec > 1) { sleep(60-$sec); } else { print "Event @ $sec\n"; sleep(30); } }

Replies are listed 'Best First'.
Re^2: Perl Cron Daemon
by perlAffen (Sexton) on Jun 02, 2011 at 15:35 UTC
    Thanks, it doesn't seem to be any burden to the box. I shall use it.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (4)
As of 2024-03-19 05:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found