我一直在尝试在 Jenkins 安排工作。我的脚本驻留在文件夹/root/test 中,我在这里共享它的位置。
[root@fahost test]# ls
jenkins_bkp README.md t1.sh t2.sh
[root@fahost test]# pwd
/root/test
[root@fahost test]#
但是当我在 Jenkins 中提到相同的路径时,它向我显示了以下结果:
控制台输出
Started by user Jenkis Test
Building in workspace /var/lib/jenkins/workspace/bkp_db
[bkp_db] $ /bin/sh -xe /tmp/jenkins3680779476651257016.sh
- cd /root/test
/tmp/jenkins3680779476651257016.sh: line 2: cd: /root/test: Not a directory
Build step 'Execute shell' marked build as failure
Finished: FAILURE
最佳答案
在作业配置中,转到构建部分,选择执行Shell,然后输入以下内容。
cd /root/test;./<file_name>.sh
关于linux - 如何让 Jenkins 执行特定文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54881448/