1

We have Job which runs everyday at midnight at 02 AM EST. Using @Scheduled annotation with cron Expression in Spring Boot based application. The issue is, Job was running fine until daylight saving time happened, after that it stopped executing. Just restarted the application last time when it happened.

Now the question is, is there a way to fix this and Job has to run at least from 2nd day of the DST change without restart. Changing the time is not an option for us.

 @Scheduled(cron = "0 0 2 * * *")

currently passing zone as JVM argument -Duser.timezone=America/New_York

3
  • your cron expression is set to run daily at 2 am. Daylight saving also happens always at 2 am. Just change your cron expression to for example 4 am and then you won't have any issues. I would however question the way you explained the problem stopped executing after DST - DST would only cause it to skip 2 am on one day but not continue skipping it. Also DST is on 3rd of November? Commented Sep 5, 2024 at 18:11
  • @JAsgarov, Yes, that was weird, it did not execute for three days after DST, so we did restart the application. It is fine on DST end, executed as normal(in November last year) Commented Sep 5, 2024 at 19:32
  • Did you find a solution to this? Commented May 1 at 17:55

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.