我刚刚阅读了关于Cron表达式格式的这篇文章:
The ? Character
The question mark (?) character can be used only in the `dayofmonth` and `dayofweek` fields, but not at the same time. You can think of the `?` character as "I don't care what value is in this field." This is different from the asterisk, which indicates every value for the field. The `?` character says that no value was specified for this field.
The reasons a value can't be specified for both fields are tough to explain and even tougher to understand. Basically, if a value was specified for each, the meaning would become ambiguous: Consider if an expression had the value 11 in a field for the day of the month and a value of WED in the field for the day of the week. Should that trigger fire only on the 11th of the month if it falls on a Wednesday? Or should it fire on both the 11th and every Wednesday? The ambiguity is removed by not allowing a value in both fields at the same time.
Just remember that if you specify a value in one of the two fields, you must put a ? in the other.
Example expression:
0 10,44 14 ? 3 WED
我想知道如何创建一个定时任务,让它在每个13号星期五执行某些操作(例如格式化数据分区),或者在14号星期六执行其他操作(例如创建新的备份)。
0 0 12 13 * 5
(这应该是每个月的第13天(13)的星期五(5),中午(12)(0)(0))。但我刚开始学习这些东西! - deebs0 0 12 13 * F
。https://ncrontab.swimburger.net/ - deebs