[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Cron Jobs and Time Zones Has Anything Changed?



On 02/12/2020 10:30, Martin McCormick wrote:
> In a recent discussion, someone indicated that there might be a
> way to set individual parts such as accounts on a unix system so
> that cron could use another time zone if needed to kickoff jobs
> on that system based on the time in another country.
>
> 	As far as I understand cron, one can set the system's
> time zone to only one value which is usually one's local clock
> time and that works very well since system logs and cron jobs all
> agree with what is appropriate for one's location.
>
> 	I record a news broadcast from one of the BBC services
> every week day at 17:45 British time.  When Europe and North
> America stop or start shifting daylight in Autumn or Spring,
> there's a really good chance of missing some of the broadcasts if
> one doesn't think about it since these shifts don't all happen on
> the same time.
>
> 	One can certainly get the time anywhere as recently
> discussed by setting the TZ environment variable but, if you tell
> cron to trigger a job at 17:45, it only knows when that is based
> on the entire system's local time.
>
> 	Has anything changed recently to make this logic
> obsolete?
>
> 	In my case, I just have an old Linux box for which I set
> it's system time zone to Europe/London and call it good but this
> could get out of hand if one had more than 2 or 3 such schedules.
>
> 	One could also setup VM's if you have the memory to spare
> but this adds a lot of resource usage and complexity to the job
> at hand so my question is basically, has anything fundamentally
> changed in the way cron is used?
>
> 	This is not a complaint at all.  I was first introduced to
> unix-like systems in 1989 and immediately knew that this was the
> sort of OS I wanted to stick with in amateur radio and technical
> tinkering in general.
>
> Martin McCormick   WB5AGZ
>
systemd timers seem to allow specification of activation time including
a time zone. However, I'm not sure if DST changes are considered - it
might just convert the specified time to the local time zone when the
timer definition is read so that you can specify '17:45 GMT' and it runs
at, say, your 10:45, but it won't automatically pick up that 17:45 GMT
is not 11:45 local. I might be wrong, though.


-- 
To do nothing is to be nothing.

Eduardo M KALINOWSKI
eduardo@kalinowski.com.br


Reply to: