Home > Back-end >  Several weeks in cron expressions, please use the * and? What is the difference between, check some
Several weeks in cron expressions, please use the * and? What is the difference between, check some

Time:05-11

Several weeks in cron expressions, please use the * and? What is the difference between, check some information, said is not clear, such as one of the data in the said

Cron expression is a string, the string separated with five or six Spaces, is divided into six or seven domains, each represents a meaning, Cron has the following two syntax format:

Seconds Minutes Hours DayofMonth the Month DayofWeek Year or
,,,,,,,

Every domain using Numbers, but also can appear the following special characters, their meaning is:
* : (1) means to match the domain of any value, if be in, you can use * domain, it indicates that will trigger events per minute,

(2)? : used only in the DayofMonth and DayofWeek two domain, it can also match the domain of any value, but it will not, because the DayofMonth and DayofWeek will influence each other,

Want to trigger on monthly 20 scheduling, for example, 20 no matter what day of the week, only use the following method: 13 13 15 20 *? , of which the last can only be used? , and cannot use the *, if you use * said no matter week will trigger, in fact is not the case,


is not actually in this way, the actual situation will be what kind, data in no said, excuse me everybody if * the last used, the actual situation would be like?

CodePudding user response:

* all values must be run,? Said don't care about what is the value, ignoring this condition, seen from the results, both of them do not have what distinction, but if the combination, can appear sometimes conflict,
For example, 13 and 15 20 *? , this expression, the 20th of each month 15 13 points and 13 seconds when the trigger, but if change to 13 13 15 20 * *, Monday to Sunday each month 20, 15 with 13 points and 13 seconds, this condition will make the system collapse, because 20 is a particular day, could not every Monday to every Sunday is 20 days, so either 13 13 15 20 *? (the 20th of each month 15 when 13 points and 13 seconds), either 13 13 15? * * (Monday to Sunday 15th of each month when 13 points and 13 seconds, in fact, to put it bluntly equivalent to 13 13 15 * *?)

CodePudding user response:

reference 1/f, one born in response:
* all values must be run,? Said don't care about what is the value, ignoring this condition, seen from the results, both of them do not have what distinction, but if the combination, can appear sometimes conflict,
For example, 13 and 15 20 *? , this expression, the 20th of each month 15 13 points and 13 seconds when the trigger, but if change to 13 13 15 20 * *, Monday to Sunday each month 20, 15 with 13 points and 13 seconds, this condition will make the system collapse, because 20 is a particular day, could not every Monday to every Sunday is 20 days, so either 13 13 15 20 *? (the 20th of each month 15 when 13 points and 13 seconds), either 13 13 15? * * (Monday to Sunday 15th of each month when 13 points and 13 seconds, in fact, to put it bluntly equivalent to 13 13 15 * *?)



Thank you very, very,

CodePudding user response:

A condition is a placeholder
  • Related