关于crontab 定时任务的菜蛋问题。

直接编写的 /etc/crontab
0 5 * * * /bin/bash /root/test.sh > /dev/null 2>&1
检查未生效,经查,如果直接编写文件,需要加上执行用户才可以。如下:
0 5 * * * root /bin/bash /root/test.sh > /dev/null 2>&1

推荐直接 crontab -e 编写任务
0 5 * * * /bin/bash /root/test.sh > /dev/null 2>&1

posted @ 2021-08-09 14:29  戴红领巾的少年  阅读(35)  评论(0编辑  收藏  举报
感谢您的阅读,如果您觉得阅读本文对您有帮助,请点一下“推荐”按钮。本文欢迎各位转载,但是转载文章之后必须在文章页面中给出作者和原文连接