Pergunta

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

Foi útil?

Solução

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

Outras dicas

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

EDIT Specifically 0 0 3 1/1 * ? *

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top