Posted by pera 1 day ago
Or learn to use lock files, which would make sure that your jobs don't run when another one is already running?
Unix shells offer the trap command, among other things, to cleanup, even in the case of errors, e.g.:
set -e
LOCK=$(ensure-lock)
trap "rm $LOCK" 0 1 2 15
do-job
https://en.wikipedia.org/wiki/Semaphore_%28programming%29And then you can translate that time to any other timezone with ease, knowing that you are referencing a specific hour in physical time that only ever happened once.
"Falsehoods programmers believe about time"
This assumption can break with:
* Leap seconds
* Calendar and time zone changes
* (In exotic circumstances) Relativity
I figured that scheduling lights to turn on at <0 AM + wake up time> was a good approach... We got a surprise early wake up last year, so I ended up changing the formula to <4 AM - 4 hours + wake-up time>.
UTC has most of the same wacky timezone problems, just less often.
Unless standardization has improved, how+when the second is smeared(if at all) means timestamps from the same system aren't usefully subtractable without communicating a separate time skew calendar.
That said, time is a big topic, and everything has different requirements but migrating to TAI and treating UTC as yet another human readable time zone has solved more (admittedly application specific) problems than it created.
around 3am is the time where "in average" human attention is the worst as its where "in average" their most relevant deep sleep phases are
now I guess the average over HN readers has a good chance to be somewhat later
but either way if the job goes wrong and triggers alarms 2-5am it very bad for the the health and sleep rithm of whoever needs to fix it and the most likely time they make mistakes
it sadly is also the time where non-international interruptions are least likely to matter
if you are an international company having international teams can be an solution
and if you are a very small team adopting job times to an overlap of low usage and your admins sleep habits can be an option
but if you need to pick a generic time and don't provide for logistics or other "start work at 4/5am" companies probably 5-6am is a better time to run your batch jobs
anyway just some random thoughts