Maxim Mironjuk
-
July 27, 2025
A cron job that runs longer than its scheduled interval quietly starts a second time, even though the first run has not finished yet. Two parallel database exports, two simultaneous backup processes, or two import scripts blocking each other are the result, often without an immediately visible error message. This article shows how flock reliably prevents overlapping cron jobs, both directly in crontab and inside scripts, and where the limits of simpler locking approaches lie.