Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Help with Perl

by i5513 (Monk)
on Jan 23, 2012 at 23:03 UTC ( #949541=note: print w/ replies, xml ) Need Help??


in reply to Help with Perl

Hi Ashok.g,

Ok, your task can be programmed dynamicaly, but .. why don't you want to use cron (if you are in Unix wolrd)?

Two approaches:

  • Regenerate /var/spool/cron/user when you need, cron will reload in the next minute
  • Regenerate /etc/cron.d/yourtask when you need it, cron will reload it, and surely will be more readable and maybe easy to implement.
  • Of course where you write "a.pl 25" will be "*/25 * * * * /path/to/a.pl"

    So, if you are in Unix environment, why not cron ?

    Thanks


    Comment on Re: Help with Perl
    Re^2: Help with Perl
    by sundialsvc4 (Monsignor) on Jan 24, 2012 at 05:24 UTC

      I gotta chime in on this one ... agreeing wholeheartedly.   Always look for the simplest available solution that leverages existing facilities.   If cron can reasonably do the job, without you creating something that will be impossible to understand three months from now, then that is probably the way that you want to do it.

      Another notion would be that you could use cron simply to execute some script at the smallest possible interval ... then maintain a list or database (SQLite?) of “what needs to be done” and “the last time it was done.”   The script simply executes each command that has come due, then exits until next time.   But, I am very reluctant to build complicated solutions to what ought to be simple, routine problems.

    Re^2: Help with Perl
    by ashok.g (Beadle) on Jan 24, 2012 at 08:36 UTC
      As I said in my post, the scripts and interval are always dynamic..... So I didn't want to always add and delete CRON entries... may be this will be my last option....
        Maybe you didn't get the idea:

        Your scheduler can be regenerate by another script which can be launch at regular intervals (by cron) or by a daemon which is always investigating if changes to scheduler are necessary

        Where does my proposition fail?

    Log In?
    Username:
    Password:

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

    How do I use this? | Other CB clients
    Other Users?
    Others studying the Monastery: (11)
    As of 2014-09-17 15:14 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      How do you remember the number of days in each month?











      Results (88 votes), past polls