> I have a cron job running perl and it is taking a very long time -- > sometimes over 24 hours. > > How can I have cron schedule my job daily, or even hourly, > and have the perl > code exit if a previouse instance of the job is still running? > > Some have suggested creating a file in /tmp and checking it before > proceding. But what if a cron job exits prematurely, perhaps > because of a > division by zero, and does not delete the /tmp file? > > How do I set up a signal handler to gaurentee that the > /tmp/do_not_run_yet > file gets deleted when the cron job exits? >
I've not done it with perl, but we have several other scripts that have this issue. We have the scripts output a file with it's PID. And anytime the script starts it looks for that file and the PID. If it finds it, it checks to see if the PID is still active - if it is, it exits, otherwise it keeps running and updates the file with the new PID. Cory -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>