سؤال

I have method annotaded with @Scheduled("cron = 0 3 * * * *") but it runs not in 3am each day but each hour. What`s wrong?

هل كانت مفيدة؟

المحلول

There are totally 6 fields in cron expression in this order - second, minute, hour, day of month, month, day(s) of week. You have configured only the second and minute.so, it will every hour in the third minute.

Cron should be 0 0 3 * * *

Now, it will run 3:00:00 AM everyday in the morning

نصائح أخرى

I believe you need 0 0 3 ... in your expression instead of 0 3 ..

EDIT Specifically 0 0 3 1/1 * ? *

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top