
我正在尋找有關我正在使用的 cron 選項卡的說明。
some job 1 * * * *
some job 1 */1 * * *
這些工作都一樣嗎?該作業將在每小時的第一分鐘運行。
也許有人可以澄清crontab*
和*/x
crontab 之間的差異。
答案1
是的,它們是相同的。從手冊頁(man 5 crontab
):
A field may be an asterisk (*), which always stands for ``first-last''.
[...]
Ranges can include "steps", so "1-9/2" is the same as "1,3,5,7,9".
因此意味著的步長所涵蓋的*/x
整個範圍(取決於 的位置) 。 *
x
在您的情況下,對於“小時”位置,從第一個到最後一個範圍是*
00-23
到*/1
23 "0,1,2,...,22,23"
。