diff --git a/crontab.md b/crontab.md index 37c86f0..84e7a38 100644 --- a/crontab.md +++ b/crontab.md @@ -6,11 +6,13 @@ Linux下的任务调度分为两类:系统任务调度和用户任务调度。 用户任务调度:用户定期要执行的工作,比如用户数据备份、定时邮件提醒等。 -`/etc/cron.deny` 该文件中所列用户不允许使用 `crontab` 命令,亲测 Ubuntu16.04 默认不存在,CentOs7.2 存在 +`/etc/cron.deny` 该文件中配置用户不允许使用 `crontab` 命令,亲测 Ubuntu16.04 默认不存在,CentOS7.2 存在,如果要禁止某个用户不能使用 `crontab` ,在此文件写入用户名即可,仅对普通用户生效,`root` 用户无效。 -`/etc/cron.allow` 该文件中所列用户允许使用 `crontab` 命令,亲测 Ubuntu16.04 、CentOs7.2 存在默认不存在 +`/etc/cron.allow` 该文件中配置用户允许使用 `crontab` 命令,亲测 Ubuntu16.04 、CentOS7.2 默认不存在。 -`/var/spool/cron/` 所有用户 `crontab` 文件存放的目录,以用户名命名 +> 系统读取顺序为先读取 /etc/cron.deny 文件,再读取 /etc/cron.allow 文件 + +`/var/spool/cron/` 所有用户 `crontab` 文件存放的目录,以用户名命名,CentOS 系统。 ``` crontab -l #显示定时任务列表 @@ -74,7 +76,7 @@ run-parts 参数指定的目录必须是以下任意一个,其他位置的目 日志 -CentOs7.2 crontab 日志路径为 `/var/log/cron` +CentOS7.2 crontab 日志路径为 `/var/log/cron` Ubuntu16.04 crontab 日志路径为 `/var/log/cron.log`