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

I've written a website using html-mason and mod_perl which is starting to get rather large. I have a number of site maintenance perl scripts (scripts that update things, scripts that test things, etc.) In the past, I've just had a cron file that runs though them on a certain schedule. However, I'd like to add functionality to my site that allows the user to run these scripts if he so desires (this would be in addition to the regularly scheduled cron job).

I know there are several easy ways to do this: system( ), simply calling a subroutine -- something along those lines, but I really want to do this the proper way. Keeping track of PIDs so I know I'm not running the same script twice, maybe logging the last run, keeping track of whether or not a script is currently running, possibly even taking cron out of the loop so I can schedule everything from the site itself.

So my question is, in very broad terms, what would be the best general course of action here? What's the 'professional' way to manage several periodic scripts? Thanks!

Replies are listed 'Best First'.
Re: Managing Scripts
by Anonymous Monk on Jul 26, 2009 at 02:41 UTC
Re: Managing Scripts
by Anonymous Monk on Jul 27, 2009 at 16:12 UTC
    Sys::RunAlone - make sure only one invocation of a script is active at a time