linux - 如何让 Jenkins 执行特定文件

标签 linux jenkins continuous-integration devops job-scheduling

我一直在尝试在 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/

相关文章:

python - 使用 pyserial 将数据发送到串行 - 在 Razor 9DOF IMU 上工作

windows - 文本文件的元数据

linux - 如何运行,带有外部库的 python 脚本,并且只使用 venv

hudson - 构建状态 Jenkins

jenkins - 使用 Jenkins 管道通过 FTP 上传

linux - 值未传递给 $1 - .htaccess

command-line - 从 Maven/Jenkins 运行 Quicktest Pro 测试?

git - Visual Studio Team Services 说 "Task PowerShell failed"虽然它没有

jenkins - 如何保护构建服务器上的凭据?

asp.net-mvc - 使用 ASP.NET MVC 的 Jenkins 主/从