解决手动运行脚本执行正常而放入crontab后不正常的方法
解决需要 导入环境变量
有两种导入方法:
在crontab -e编辑时加入
. /etc/profile;/bin/sh #主要"."后要有个空格
0 12 * * * . /etc/profile;/bin/sh /your/sh/your_sh.sh
在你要运行的脚本的开头加入
source /etc/profile
阅读 4k
0 条评论
得票时间
解决需要 导入环境变量
有两种导入方法:
在crontab -e编辑时加入
. /etc/profile;/bin/sh #主要"."后要有个空格
0 12 * * * . /etc/profile;/bin/sh /your/sh/your_sh.sh
在你要运行的脚本的开头加入
source /etc/profile