tags:

views:

16

answers:

1

I don't think this is an exact duplicate of other questions, but feel free to point me somewhere if it's already been answered.

I'm looking for a way to have a cron job only start running if it isn't already running. For example, if a job runs every 15 minutes but occasionally takes an hour to run, I don't want duplicate processes to start and overlap what the original job is doing.

In other questions others have talked about making a pid file that stops the job from starting duplicates (or similar strategies), but my case is a little different. I have multiple machines that run cron jobs, and I want a currently-running process on any of them to stop new instances of that job from starting. So a pid file wouldn't be enough, since it would be local to the one machine.

What is the best way of dealing with this situation?

A: 

A PID file over a shared folder?

LatinSuD