Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

Re: Help with Perl

by i5513 (Pilgrim)
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 " 25" will be "*/25 * * * * /path/to/"

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


    Replies are listed 'Best First'.
    Re^2: Help with Perl
    by sundialsvc4 (Abbot) 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?

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

    How do I use this? | Other CB clients
    Other Users?
    Others imbibing at the Monastery: (6)
    As of 2018-05-25 19:16 GMT
    Find Nodes?
      Voting Booth?