shell正常运行,加入定时任务执行失败

例如简单的ifconfig命令,在shell中运行成功,但是在crontab 中执行失败。

定位原因:环境变量

解决方案:

whereis ifconfig

然后在shell中加入:

PATH=PATH:/sbin

然后可以验证在crontab中也可以正常运行了

原文地址:https://www.cnblogs.com/music378/p/8252862.html