Jenkins 执行 bash shell 命令
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/20740016/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Jenkins execute bash shell command
提问by TienHoang
Hello all I have build an CI server by jenkins. I want to execute remote bash shell on testing server (Ubuntu server 12.04 LTTS) by this sample script through ssh plugin
大家好,我已经建立了 jenkins 的 CI 服务器。我想通过此示例脚本通过 ssh 插件在测试服务器(Ubuntu 服务器 12.04 LTTS)上执行远程 bash shell
#!/bin/bash
cd "$(dirname "##代码##")"
echo "[INFO] Stopping service mix service"
cd /home/setup/Development/apache-servicemix-4.5.0/bin
./stop
echo "[INFO] Wait few secs for stopping service"
sleep 5
echo "[INFO] Start service"
./start
sleep 1
exit;
But the servicemix can not start, if I do manually ssh login from bash shell, then execute this script (stored in test server) it can work well. Any Idea for this. Thank you
但是servicemix无法启动,如果我从bash shell手动ssh登录,然后执行这个脚本(存储在测试服务器中)它可以正常工作。对此有任何想法。谢谢
回答by Armali
I have resolve this. This is error failed load JAVA_HOME from script. Actually this run on different shell configuration environment that have not load configuration from my .profile. – TienHoang
我已经解决了这个问题。这是从脚本加载 JAVA_HOME 失败的错误。实际上这运行在不同的 shell 配置环境中,这些环境没有从我的 .profile 加载配置。– 天煌