Run cron job only if it isn’t already running

Use flock. It’s new. It’s better.

Now you don’t have to write the code yourself. Check out more reasons here: https://serverfault.com/a/82863

/usr/bin/flock -n /tmp/my.lockfile /usr/local/bin/my_script

Leave a Comment