Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Meaning Of Spring Cron Expression "*/5 * * * * ?"

I used spring scheduler with cron expression

*/5 * * * * ?

(for every 5 seconds) . It's worked for last one month, suddenly it's stopped in last two days.

After Restarting server again it's working fine.

Is there any difference between

*/5 * * * * ?
*/5 * * * * *

? it's based on any month basis.

So what is the meaning of ? here. Want to know the reason why it's stopped?

Thanks in Advance.

like image 893
Thangadurai Avatar asked Feb 08 '23 04:02

Thangadurai


1 Answers

Here "

*

means all values. For example, dayofmonth="*" means run the process every day.

"?"

is used only for dayofmonth and dayofweek attribute

and means "without regard to this value" For example, hours="12" dayofweek="MON-FRI" dayofmonth="?" means "Run at noon every weekday (without regard to the day of the month)".

","

separates multiple values. For example, dayofweek="MON,FRI" means every Monday and Friday. Do not includes spaces after the comma.

"/"

specifies increments. For example, minutes="0/15" means start at minute 0 and run every 15 minutes.

"L" is used only for dayofmonth and dayofweek and means "the last day of the month/week".

like image 76
Mohit Singh Avatar answered Feb 15 '23 01:02

Mohit Singh