Hello fellow monks, I'm looking for a bit of advice on the relative merits of running a script via cron on some interval, or having a process running. This is the basic scenario:

I have a web-database/CMS system, where, right now 100% of the work is done by cgi's acting on a database. There are some functions I'd like to have happen independent of the web server, such as specific actions taken at specific time intervals (like, for example, sending an email when a record is about to expire, etc.). It seems in order to have these sorts of things happen, I have three options:

1) Each time a script is called by the web server, it checks to see whether or not any actions are pending, then does them.
2) I set up a script to be run by cron on specific intervals, that checks for pending actions, and completes them.
3) I have a running script that periodically checks for pending action

An important thing to know is that I can't imagine that people will have actions that will happen with any more frequency than once an hour. Option 1 is my least favorite, because it depends on use of the web cgi's - which is not at all predictable. I'm leaning toward using cron, but I can imagine some of the advantages of having a running process.

Ideas, or experiences? Thanks!


In reply to Cron or running process? by michellem

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.