Jay,

----- Original Message ----- From: "Jay Savage" <[EMAIL PROTECTED]>
To: "Beginners List" <beginners@perl.org>; "Mike Blezien"
<[EMAIL PROTECTED]>
Sent: Saturday, March 10, 2007 5:11 PM
Subject: Re: OT. Cron jobs


On 3/10/07, Mike Blezien <[EMAIL PROTECTED]> wrote:
Hello,

Sorry for the OT question, but couldn't find the info I was looking for and
thought could get a quick answer from the list.

We have a perl script that needs to run 4 times a minute. Can this be done
via
cron or is there an easier way to do this within the Perl script itself? This
4
times a minute every day.


Mike,

As far as I know, cron doesn't have control finer-grained than a minute.

Your best best would be to create a script that continuously forks and
then sleeps for 15 seconds. See the docs for your system's deamon
management service (init on *ix, launchd on OS X) to find out how to
make sure it stays alive.

Since sleep only handle's whole seconds, you'll want to take a look at
Time::HiRes if you really need to execute exactly four times every
minute. That way you can time the fork() call and adjust the sleep
microseconds accordingly. Otherwise, you'll eventually get some
accumulated error in the sleep cycle. Not much, of course, but it
sounds like precision counts here.

HTH,

-- jay
--------------------------------------------------

thx's we'll check out the Time::HiRes module.

Mike


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to