crontab不能识别java命令
描述
crontab 执行 nohup java -jar xxx.jar>/dev/null 2>&1 &
无法正常执行启动
原因
crontab默认只加载/ect/environment
配置文件,未加载/etc/profile
配置文件
解决方案
方案1:
用绝对路径去启动命令
nohup /usr/jdk1.8.0/bin/java -jar xxx.jar>/dev/null 2>&1 &
方案2:
在shell手动状态/etc/profile配置
. /etc/profile
. ~/.bash_profile
方案3:
将需要执行的命令以软连接的形式放到/bin目录下面