旧 crontab 文件中的第一个非注释行以五个星号开头:
* * * * * ([a_command]) >/dev/null 2>&1
Run Code Online (Sandbox Code Playgroud)
作者已经走了,所以我不知道他们的意图。 全通配符对 (Solaris 8) cron 意味着什么? 这里的赌注要么运行一次,要么连续运行,要么永不运行,不幸的是,这很广泛。
如果您想知道前面的注释行,那就是“不要删除”。
注意:此 cron 文件正在运行。这个问题不是关于损坏的 cron 文件或需要故障排除的 cron 文件的问题的重复。
Luk*_*ame 61
每个月的每周的每一天的每一分钟,该命令都会运行。
man 5 crontab有这方面的文档。如果您只是键入man crontab,您将获得 crontab命令的文档。您需要的是手册页的第 5 部分,其中涵盖了包括该/etc/crontab文件在内的系统配置文件。为了将来参考,这些部分在man man:
1 Executable programs or shell commands
2 System calls (functions provided by the kernel)
3 Library calls (functions within program libraries)
4 Special files (usually found in /dev)
5 File formats and conventions eg /etc/passwd
6 Games
7 Miscellaneous (including macro packages and conven?
tions), e.g. man(7), groff(7)
8 System administration commands (usually only for root)
9 Kernel routines [Non standard]
Run Code Online (Sandbox Code Playgroud)
Moh*_*sal 44
*= 总是。它是 cron 调度表达式每个部分的通配符。
所以,* * * * *手段every minute的every hour的every day中every month和every day的week。
* * * * * command to execute
? ? ? ? ?
? ? ? ? ?
? ? ? ? ?
? ? ? ? ?????? day of week (0 - 7) (0 to 6 are Sunday to Saturday, or use names; 7 is Sunday, the same as 0)
? ? ? ??????????? month (1 - 12)
? ? ???????????????? day of month (1 - 31)
? ????????????????????? hour (0 - 23)
?????????????????????????? min (0 - 59)
Run Code Online (Sandbox Code Playgroud)
上面漂亮的图是维基百科提供的
另一个例子:
0 * * * *- 这意味着 cron 将始终在分钟0(每小时)
0 1 * * *时运行 - 这意味着 cron 将始终在 1 点钟运行。
* 1 * * *- 这意味着当小时为 1 时,cron 将每分钟运行一次。所以1:00, 1:01, ... 1:59。
小智 11
First star = Minutes: 0-59
Second star = Hours: 0-23
Third star = Day of Month: 0 - 31
Fourth star = Month: 0 - 12
Fifth star = Day of Week: 0 - 6 (0 means sunday)
Run Code Online (Sandbox Code Playgroud)
假设你想每个月的 1 号运行一些东西。
0 0 1 * * something.sh
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
88103 次 |
| 最近记录: |