Cron запустил задачу дважды: как flock не даёт наложиться двум копиям скрипта
- Words
- 46
- Chars
- 315
- AI summary
- Yes
A cron job started again before the previous run had finished, producing two START entries and two competing UPDATEs. The article reproduces this on Linux and fixes the race with flock from util-linux. It compares a “skip” approach with a “wait” approach and shows the same method in Python using fcntl.flock. The results come from a local test setup.
Задача в crontab ещё не закончилась, а следующий запуск уже стартовал: два START, два конкурирующих UPDATE. Воспроизводим на Linux, закрываем гонку через flock из util-linux, сравниваем «пропустить» и «подождать», и показываем тот же приём из Python через fcntl.flock. Весь вывод — с локального стенда. Читать далее
Open article