1.((null)) Unauthorized SELinux context=system_u:system_r:system_cronjob_t:s0-s0:c0.c1023
file_context=unconfined_u:object_r:admin_home_t:s0 (/etc/crontab)
解决:
chcon -R -usystem_u -robject_r -tsystem_cron_spool_t /etc/crontab
systemctl restart crond
crontab没有运行,查看systemctl status crond 发现报了上面的错误,大致是说SELinus安全策略阻止执行,是因为crontab文件
的安全上下文不对(类似linus中的文件用户的操作权限),使用chcon命令修改对象的安全上下文 再重启crond服务
2. 对于一些服务进程 脚本可以手动执行 用contab就不可以 使用 例如mongod
解答:crontab有自己的环境变量环配置 ,对于没配置的环境变量,命令必须是绝对路径
crontab范例
每五分钟执行 */5 * * * *
每小时执行 0 * * * *
每天执行 0 0 * * *
每周执行 0 0 * * 0
每月执行 0 0 1 * *
每年执行 0 0 1 1 *