通过 shell脚本给linux系统的 crontab新增定时任务
shell脚本(会自动重新加载crontab):
#备份存量定时任务
crontab -l >cron.cron
#追加定时任务到文件末尾一行
echo '20 0 * * *。。。。。' >> cron.cron
#把文件的定时任务覆盖掉crontab里面的
crontab cron.cron
crontab 文件
路径:/etc/crontab
#root重启crontab服务
命令: systemctl restart crond.service
#root观察crontab服务状态
systemctl status crond.service
#root查看服务日志:
tail -f /var/log/cron