Jenkins远程执行shell出现java: command not found

之前在使用Jenkins执行远程shell脚本时,出现提示java: command not found;
多方查找原因后发现是因为远程执行shell脚本时,不会自动加载环境变量,导致出现此错误,
解决方案就是在脚本前加上这段代码即可source /etc/profile;

source /etc/profile

cd /root/shell
sh erp-shop-h5-server.sh
原文地址:https://www.cnblogs.com/linjiqin/p/10980120.html