michellem has asked for the wisdom of the Perl Monks concerning the following question:
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!