News for hackers. Stuff that matters.
Re:Prevent duplicate cron job running by 1500100900 on Saturday September 04, 2021 @02:47AM (#28412711)
OpenBSD's crontab provides a `-s command` flag which does similar thing in principle:

https://man.openbsd.org/crontab.5

"-s command

Only a single instance of command will be run concurrently. Additional instances of command will not be scheduled until the earlier one completes."

But I don't think it saves the state somewhere permanently, which isn't a big problem until cron's process dies for some reason.

Re:Prevent duplicate cron job running by absc on Saturday September 04, 2021 @03:44AM (#28412986)
If you need to save state across executions, you should write a daemon instead.
Re:Prevent duplicate cron job running by adrianmonk on Saturday September 04, 2021 @02:15PM (#28417629)
cron applies this very method of attempting to handle state by merely being a daemon, and it's not enough because cron can crash.

The approach you're suggesting is what led to the problem you're proposing it as a solution for.

Re:Prevent duplicate cron job running by jbverschoor on Saturday September 04, 2021 @07:19AM (#28414073)
Then "rm" should be a daemon too