1

Since there can be problems with the time change from summer/winter or winter/summer, I wanted to ask how I could solve the problem within the bash script-2?

I think in the winter time it should not come normally to problems since CRON acts here smartly and does not execute CRONS twice, nevertheless I would be grateful here for tips how I could configure the best in both time changes.

SUMMER-TIME-CHANGE-GERMANY (RUN AT SAME TIME)
2h - CRONTAB -> Bash-Script 1
3h - CRONTAB -> Bash-Script 2

WINTER-TIME-CHANGE-GERMANY (SHOULD NOT BE A PROBLEM?!)
2h - CRONTAB -> Bash-Script 1
3h - CRONTAB -> Bash-Script 2
1
1

One approach:

Have the system clock or at least cron run at UTC. UTC has no daylight savings time and you won’t have any issues.

(And like many utilities and tools allow : only convert from UTC to the time zone most relevant to a person in the presentation layer.)

A second consideration:

Cron is a time based scheduler. If you have real job dependencies you can’t really rely on cron to ensure they are met. If batch job B must always start after job A ; simply use a single batch job (with some more error checking and handling )

#!/bin/sh
/do/job-A
/do/job-B 
5
  • And how to use utc with cron without using utc as systemwide setting and only for there particular 2 jobs? – Omexlu Mar 28 at 8:31
  • That is what the other comment already links to... serverfault.com/questions/791713/… – Bob Mar 28 at 8:36
  • Yes but there are other jobs on crontab that should be affected by that, so I just need it for 2 jobs? – Omexlu Mar 28 at 8:47
  • The custom TZ time zone setting effects only the jobs defined below/after that line1 job1 in system TZ schedule ; line two CRON_TZ=UTC ; line 3 job2 running on UTC schedule – Bob Mar 28 at 9:24
  • OK thank you, for 2 and 3 h in the night, what need to be set in UTC? – Omexlu Mar 28 at 10:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.