我进去了:
* 22 * * * test > /dev/null
然而,我通过电子邮件被通知,这是运行每分钟。 我想我很困惑,因为我认为这是我想要的。
我进去了:
* 22 * * * test > /dev/null
然而,我通过电子邮件被通知,这是运行每分钟。 我想我很困惑,因为我认为这是我想要的。
当前回答
这里还有一些例子
每隔6小时,整点后46分钟播放一次: 46 */6 * * * 在凌晨2:10运行: 10 2 * * * 在凌晨3:15运行: 15 3 * * * 在凌晨4:20运行: 20 4 * * * 在早上5:31运行: 5 * * * 下午5点31分开始: 31 17 * * *
其他回答
这里还有一些例子
每隔6小时,整点后46分钟播放一次: 46 */6 * * * 在凌晨2:10运行: 10 2 * * * 在凌晨3:15运行: 15 3 * * * 在凌晨4:20运行: 20 4 * * * 在早上5:31运行: 5 * * * 下午5点31分开始: 31 17 * * *
每天晚上10点跑步一次,你应该这样做:
0 22 * * *
全尺寸图片:http://i.stack.imgur.com/BeXHD.jpg
来源:softpanorama.org
以下是我每次写一个新的crontab条目时所查看的内容:
从terminal -type开始编辑:
zee$ crontab -e
您将添加到crontab文件:
0 22 * * 0 some-user /opt/somescript/to/run.sh
释义:
[
+ user => 'some-user',
+ minute => ‘0’, <<= on top of the hour.
+ hour => '22', <<= at 10 PM. Military time.
+ monthday => '*', <<= Every day of the month*
+ month => '*', <<= Every month*
+ weekday => ‘0’, <<= Everyday (0 thru 6) = sunday thru saturday
]
此外,检查您的机器正在运行的shell并相应地命名文件,否则它将无法执行。
使用echo $ shell或echo $0检查shell
它可以是“Bourne shell (sh), Bourne again shell (bash),Korn shell (ksh)..等”
它每时每刻都在运行。试着在每小时的第一分钟运行它22:
0 22 * * * ....
crontab的语法
* * * * *
Minute(0-59) Hour(0-24) Day_of_month(1-31) Month(1-12) Day_of_week(0-6) Command_to_execute
你的语法
* 22 * * * test > /dev/null
你的工作将在每周、每月和每年的每分钟22:00执行。
在分钟位置添加一个选项(0-59)将在每周、每月和每年的22:00 HRS运行一次。
0 22 * * * command_to_execute
源https://www.adminschoice.com/crontab-quick-reference