I have a script that I'd like to run every two hours on the half-hour (i.e. at 3:30, 5:30, etc.). Doing this with NT's AT scheduler (and Unix's crontab, I think) would require 12 separate scheduling lines. That's not fun to administer if the schedule changes. I suppose I could find a more robust scheduler, but I'm curious if there's a Perlish solution my fellow monks like to employ in situations like this.

I started working on a simple sub to include in my script, which would sleep for a while, check the time, then come to life and run the main part of the script. I could fudge by with that in this case, but the script won't really start "on time", and this solution is not all that elegant.

What I'm imagining is some bit of code that wakes the script up at the right time, each time. I haven't tried a loop of code that continually checks the time without sleeping, because that seems like it would be extremely processor-intensive. I suppose this is exactly what schedulers are for, but is there a different/better solution?

Thanks!

In reply to Scheduling with Perl? by EyeOpener

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.