【发布时间】:2019-03-12 10:07:55
【问题描述】:
我有一个在 JBoss9 中部署应用程序的 bash 脚本。 当我使用命令 ./jbctl -c restart tail -f nohup.out 从 ubuntu 终端运行 bash 脚本时,它工作正常;
但是当我在 Jenkins - Build - Execute shell 中调用相同的 bash 脚本时,它会向我显示各种错误,例如
./jbctl: line 123: cat: command not found
./jbctl: line 123: grep: command not found
./jbctl: line 123: cut: command not found
./jbctl: line 123: sed: command not found
./jbctl: line 124: cat: command not found
/tmp/jenkins2547454576675677717.sh: line 10: tail: command not found
Build step 'Execute shell' marked build as failure
Finished: FAILURE
没有这个 jbctl.sh 文件,应用程序不能被初始化。由于此 ./jbctl.sh 文件中有 bash 命令,因此这些命令不会在 Jenkins - Build - Execute shell 中执行。
还有其他方法可以在 Jenkins 中运行这个 jbctl.sh 脚本吗?其实这是 bash 脚本。
【问题讨论】:
-
你是从你的 ubuntu 还是从其他 Jenkins 代理执行的?另外请确保您在 Jenkins 中是否有正确的
$Path变量(Manage Jenkins -> Global Properties -> Environment variables)。跨度> -
我在 Ubuntu 上执行
标签: bash shell jenkins jenkins-pipeline