解决手动运行脚本执行正常而放入crontab后不正常的方法

解决须要 导入环境变量code

有两种导入方法:crontab

在crontab -e编辑时加入变量

. /etc/profile;/bin/sh #主要"."后要有个空格
0 12 * * * . /etc/profile;/bin/sh /your/sh/your_sh.sh

在你要运行的脚本的开头加入file

source /etc/profile
相关文章
相关标签/搜索