Mac*_*aca 1 fedora cron amazon-ec2
我为 crontab 输入了一个命令,但似乎什么也没发生。
#vi /etc/crontab
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/
# For details see man 4 crontabs
# Example of job definition:
# .---------------- minute (0 - 59)
# | .------------- hour (0 - 23)
# | | .---------- day of month (1 - 31)
# | | | .------- month (1 - 12) OR jan,feb,mar,apr ...
# | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
# | | | | |
# * * * * * command to be executed
10 * * * * cd /var/www/html/mt; ./tools/run-periodic-tasks ~
Run Code Online (Sandbox Code Playgroud)
和 crond 正在运行..
# service crond status
# crond (pid 7070) is running...
它假设每 10 分钟从 Movable Type 重建一个 html。我使用的是 Amazon EC2 Linux 64 位。
对于系统范围的 /etc/crontab,您还必须指定以哪个用户身份运行。这本身就是一列,在道琼斯指数之后,但在命令运行之前。
此外,正如 Ignacio 刚刚提到的,为了每 10 分钟运行一次,您需要使用 */10。
因此
*/10 * * * * USER cd /var/www/html/mt; ./tools/run-periodic-tasks ~
Run Code Online (Sandbox Code Playgroud)