I want a cronjob set up to change the “closed” sigh to say “open”.
How do I set that with UTC?
I want a cronjob set up to change the “closed” sigh to say “open”.
How do I set that with UTC?
if utc_now().to_timzone(my_timezone) >= "9AM":
sign = "open"
I know you didn't mean this, but it was a problem I thought about: How does one make sure the local clock tower actually changes in cadence with DST? You can't, so I guess you could use open vz with a camera to have your open sign be based on what time is actually seen on the tower.I know it's just an example, but I say in jest, don't use cron jobs to change your closed sign to open! If you can't make it to your shop, people will be waiting around all day for you to unlock the door. Very unhappy customers.
The second advantage is that you can check in multiple timezones especially if the server itself is in DST. Does cron itself let you set the timezone for each individual check? Or does it only run in one timezone? As far as I can tell, it only lets you use one timezone.
For something important, I would look at it completely differently by testing it:
- What happens if I have a scheduled cronjob running every day at a certain time, but I want to override it for one specific day and have that job run later? (e.g. how is it accomplished so that I can maintain the default behavior while overriding and opening later on specific days)
- How can I make different commands run in different timezones? (as it stands now I find conflicting information about this)
- What happens if my machine lost power when the job needed to run? (it looks like it just never runs the script)
- Can I input a specific time and test if cron will set open for that specific time? (this doesn't seem possible)
and historically there have been even weirder cases
If youre just gonna run it every hour, you might as well while(1){ check time; do stuff; sleep 1 hour;} now there's one less dependency?
For instance, Nepal uses UTC+05:45, and the time shifted by 15 minutes in 1986 (from UTC+05:30): https://www.timeanddate.com/time/zone/nepal/kathmandu
That said, I think running every 15 minutes handles all currently-observed time zones.