Ravi Sir's Cards › AWS
Run only once
This revision card explains Run only once. It starts from the need that two cron runs can overlap. It describes lock or skip. The how-to section notes wait max 30 s. An example on the card is lock frees on exit.
Read card text
What this card says
Why do we need it?
Two cron runs can overlap.
What is it?
Lock or skip.
flock -n /tmp/job.lock job.sh
How to do it
Wait max 30 s.
flock -w 30 /tmp/job.lock job.sh
Example
Lock frees on exit.