Prevent two copies of a cron job from running simultaneously. flock takes an FD to a lock file; if the lock is held, the second invocation exits immediately.
Make sure only one copy of a long-running cron job runs at a time. Uses a non-blocking advisory lock on a sentinel file — second invocation exits immediately if the lock is held.