Queue'ing cron jobs up to 10 times
Posted
by
webnoob
on Server Fault
See other posts from Server Fault
or by webnoob
Published on 2011-02-21T20:35:11Z
Indexed on
2011/02/21
23:27 UTC
Read the original article
Hit count: 276
Hi All,
This kind of touches on another post I made but is different so I have posted it as a new question.
I have a script that runs that may take just over 1 minute to process, and my cron is set to run every minute. I can stop another cron job executing the script if the first one hasn't finished by using flock (php) in the file, however, this means that I would lose one iteration of the routine and have to wait nearly a minute before it is triggered again (as my understanding leads me to believe).
What I would like to do is if the script is locked, not bomb out, but wait. Over time however, this could get quite high so I would also like to limit the amount of queued cron's to 10.
I am a real newbie with Linux (had a Linux VPS for 3 days now) so I am not sure if my solution is even practical.
Thanks.
© Server Fault or respective owner