【发布时间】:2016-06-10 01:18:44
【问题描述】:
哪个是crontab 工作的正确定义?
在执行路径之前有没有user?
.---------------- 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
| | | | |
* * * * * <user> <command>
在 Debian 上,crontab -l 显示一个备份示例:
....
For example, you can run a backup of all your user accounts
at 5 a.m every week with:
0 5 * * 1 tar -zcf /var/backups/home.tgz /home/
...
这里没有user!!/etc/crontab 内容(在同一个盒子上)给出了不同的线索:
....
and files in /etc/cron.d. These files also have username fields,
that none of the other crontabs do.
...
【问题讨论】:
-
每个用户的 crontab 没有用户名,因为用户始终是文件的所有者。全局
/etc/crontab文件有一个额外的用户名字段。 -
这不是编程问题。有关 Unix 的问题属于 unix.stackexchange.com。