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

Re: Cron Jobs and Time Zones Has Anything Changed?



On Wed, Dec 02, 2020 at 08:53:28AM -0500, Dan Ritter wrote:
> It would not be ridiculous to run a wrapper program out of, e.g.
> cron.hourly, which used an explicitly set TZ as a cue to run
> another job.

I was vaguely thinking of a similar approach.  Set up a job that runs
every hour, or across a set of hours that will cover all the possible
cases that you care about, in your crontab.  Within the job itself,
set a TZ variable and determine the time in that time zone by whatever
means necessary, and then either abort or continue based on that time.

This is also similar to how one approaches a complex date-based task
such as "run on the second-to-last day of each month".  For that one,
you can set up the job to run on the 27th through the 30th every
month.  Then within the job itself, determine whether it's the
correct day, and abort if it's not.


Reply to: