News for hackers. Stuff that matters.
Re:OpenBSD cron(8) now supports random ranges with steps by thiagocsf on Monday May 08, 2023 @02:23PM (#35865176)
It’s not gross. It’s a simple solution to a simple and common cron problem

Just because it doesn’t consider external executions, it doesn’t mean it’s a bad solution. Horses for courses etc

Re:OpenBSD cron(8) now supports random ranges with steps by pengaru on Monday May 08, 2023 @02:28PM (#35865245)
> It’s not gross. It’s a simple solution to a simple and common cron problem

No, it's gross. By providing that facility in the wrong place it discourages implementing it in the right place to people who come at the problem from the cron perspective.

Wrap the command in a flock-running script. That script goes in the crontab entry. When you're inevitably debugging your cron-scheduled command - paydirt! The command serializes itself still while you're manually testing instead of shitting itself.

Re:OpenBSD cron(8) now supports random ranges with steps by eska on Monday May 08, 2023 @03:26PM (#35865937)
Isn’t that the same? Just because you check a file lock in your script doesn’t mean that other invocations of the program without the script will check the lock.
Re:OpenBSD cron(8) now supports random ranges with steps by pengaru on Monday May 08, 2023 @03:36PM (#35866049)
No, it's not the same. The crontab entry reflects what you'd run to reproduce what the crontab does.
Re:OpenBSD cron(8) now supports random ranges with steps by eska on Tuesday May 09, 2023 @08:52AM (#35873606)
Ok, but your original criticism stated that solving this in cron is bad because the program may be run outside of cron:

* It's not just cron that can cause concurrent execution, and if that matters you generally want to robustly prevent it - not just if cron is the executor.*

So you did not like that exclusion only worked when triggered from cron. But in your case it also only works when triggered from your script. So cron just made your script an integrated feature and you’re essentially criticizing your own solution.

Re:OpenBSD cron(8) now supports random ranges with steps by Apofis on Monday May 08, 2023 @05:51PM (#35867475)
Lock files in scripts are actually pretty unreliable, learned this the really hard way and the lesson cost $10's of thousands of dollars.
Re:OpenBSD cron(8) now supports random ranges with steps by r3trohack3r on Monday May 08, 2023 @09:03PM (#35869020)
Surprised to see this, mind sharing the experience?

How did the lock fail? Was there a more reliable fix?