操作系统:Ubuntu 14.04
我想在全年每周一至周五格林威治标准时间上午 5 点至下午 7 点之间每两小时第 37 分钟运行 PHP 脚本 /home/app/myapp.php。
crontab 文件的语法是什么?
答案1
37 5-19/2 * * 1-5
因为,引用手册页:
field allowed values
----- --------------
...
day of week 0-7 (0 or 7 is Sun, or use names)
Ranges of numbers are allowed. Ranges are two numbers separated with a hyphen.
...
Step values can be used in conjunction with ranges. Following a range with ``/<number>'' specifies skips of the number's value through the range.
Names can also be used for the ``month'' and ``day of week'' fields. ... Ranges or lists of names are not allowed.