The first five fields shall be integer patterns that specify the
following:
1. Minute [0,59]
2. Hour [0,23]
3. Day of the month [1,31]
4. Month of the year [1,12]
5. Day of the week ([0,6] with 0=Sunday)
Each of these patterns can be either an asterisk (meaning all valid
values), an element, or a list of elements separated by commas. An ele‐
ment shall be either a number or two numbers separated by a hyphen
(meaning an inclusive range). The specification of days can be made by
two fields (day of the month and day of the week). If month, day of
month, and day of week are all asterisks, every day shall be matched.
If either the month or day of month is specified as an element or list,
but the day of week is an asterisk, the month and day of month fields
shall specify the days that match. If both month and day of month are
specified as an asterisk, but day of week is an element or list, then
only the specified days of the week match. Finally, if either the month
or day of month is specified as an element or list, and the day of week
is also specified as an element or list, then any day matching either
the month and day of month, or the day of week, shall be matched.
这将每分钟运行一次您的命令。这是有效的语法。
以下是来自的血腥细节
info crontab
:您链接到的文章看起来不错。它为您提供了一些很好的示例,实际上它比我在此处提供的手册页摘录更容易阅读。
您应该能够使用它谈论的语法。
根据我的 crontab,@daily 在 6:25 AM 运行。
您还可以通过在每列中使用正斜杠来指定奇数频率。
* */2 * * * foo
将
foo
在可被 2 整除的时间执行,即:12 AM、2 AM、4 AM、...、10 PM、12 AM。记住这个命令
*/1 * * * * env > /home/yourUser/env.out
将在您的 crontab 中输出 crontab 环境的环境变量供您使用。您可以使用 ${HOME}、${SHELL} 等变量来使脚本更清晰,也可以在另一台机器上使用该脚本。