Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

by Samn (Monk)
on Aug 10, 2003 at 00:26 UTC ( [id://282518]=perlquestion: print w/replies, xml ) Need Help??

Samn has asked for the wisdom of the Perl Monks concerning the following question:

Replies are listed 'Best First'.
Re: Scheduling without cron or modules
by Zaxo (Archbishop) on Aug 10, 2003 at 01:08 UTC

    belg4mit has written a cron daemon in perl. See a cron; in perl. I haven't tried it, but it appears to be as you specify.

    You say,

    I don't want to use Cron or any modules, for a good reason.
    I'm always curious to know those reasons. They are not usually as good as one thinks.

    After Compline,
    Zaxo

    282543
    by Samn (Monk) on Aug 10, 2003 at 02:50 UTC
          Schedule::Cron works very nicely for these types of things. Even if you don't want to use it looking at the implementation might give you a good starting point.
          If it is going to be pre-packaged anyway, use whatever modules you want (such as the excellant Schedule::Cron) and just be sure to include them in the package you distribute. That isn't hard at all (as long as they are pure Perl). Just update the versions in your package when you release updates to your core engine, and allow for advanced users to specify that the system installed versions of the required modules be used instead. Simple.
          vroom makes a good point. If you're going to be packaging up your goodies for the less technically inclined, it shouldn't be all that hard to embed a good cron module into your package. The same goes for any module that isn't part of the perl core, but would save you development time and offer a well-tested solution for issues that might otherwise be tricky for you or even risky for users of your package.

          Of course, when the CPAN module you embed or adapt into your package undergoes an important fix, you'll need to update your package accordingly. This could also be a very good feature for customers who are not "CPAN-enabled" -- they need only rely on you to make sure that their installation takes care of all that bug-fix/web-security stuff, so long as they just keep up to date on this one complete package that they get from you.

    Re: Scheduling without cron or modules
    by cees (Curate) on Aug 10, 2003 at 01:02 UTC

      If your reason for not using cron is that it is not available on the box, then you could consider using cron on a separate box and having it call a cgi script on your server at the given times (obviously with some authentication). Of course you need a separate box for this to work.

      Also, you could do a google search on 'cron service'. I noticed a few companies that offer cron like services (although I have never used them, and could not give you a recommendation on them)...

      Cheers,

      - Cees

      Update: Now that I know your reason for not wanting to use cron, I realize that my answer doesn't help you one bit. So you can ignore this message. For future questions, the more info the better. There is no such thing as too much info (There is always the 'readmore' tag if you are worried about the length of your post). Sorry I couldn't be of more help, but it looks like you got some good answers below...

    Re: Scheduling without cron or modules
    by bean (Monk) on Aug 10, 2003 at 08:29 UTC
      I like the "cron in perl" idea offered in a previous post, but either of your solutions could be made much less wasteful with the simple addition of only having a 1 in N chance of firing. In your case, N might be somewhere around 800 - it would go off ~100 times a day, which should be often enough. The thing I don't like about the "monitor.cgi" idea is the name - it implies that you're planning on running it as a cgi (which I don't think will work, because IIRC cgi's terminate if the client disconnects/times-out). A script that runs all the time is a daemon (so it would be "monitor.pl") - and if it's robust enough, it shouldn't need monitoring. So, we're back to the "cron in perl"...
      282597
      by Samn (Monk) on Aug 10, 2003 at 11:20 UTC
            I'd just like to point out that webhosting providers often somehow check for processes that are running for too long (suspecting that they are daemons, which are usually not allowed), and kill them.
            this might be a problem if your pseudo-cron sleeps() for hours at a time in the background, i guess, and severly limit the 'ease of installation' factor...
            just my two centimos, YMMV

      Log In?
      Username:
      Password:

      What's my password?
      Create A New User
      Domain Nodelet?
      Node Status?
      node history
      Node Type: perlquestion [id://282518]
      Approved by The Mad Hatter
      help
      Chatterbox?
      and the web crawler heard nothing...

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

        No recent polls found