简体   繁体   English

从詹金斯(Jenkins)作业中调用Bash命令时,行为异常

[英]Bash command not behaving as expected when invoked from Jenkins job

I have a python script which executes the following command: 我有一个执行以下命令的python脚本:

commands.getstatusoutput("./some_program -bg; sleep 10; kill -SIGUSR2 `pidof 
                                some_program`; kill -9 `pidof some_program`")

In short, this calls a program (some_program) and puts it in the background, then, after 10s, it sends a signal to the program to prompt it to dump some data into a csv file, after which we kill the program. 简而言之,这将调用一个程序(some_program)并将其置于后台,然后在10秒钟后,它会向该程序发送信号,提示其将某些数据转储到csv文件中,然后我们将其杀死。

When I run the python script manually, it dumps the output to the csv file as expected. 当我手动运行python脚本时,它会按预期将输出转储到csv文件中。 When I run the program through a Jenkins build however, the csv file is not created. 但是,当我通过Jenkins构建运行程序时,不会创建csv文件。

Any ideas? 有任何想法吗?

Sounds like a permission problem to me, are you running jenkins with a different user? 在我看来,这是一个许可问题,您是否在与其他用户一起运行jenkins? I would chmod 777 the folder temporally only to see if thatś the issue – gerosalesc 我会暂时将chmod 777更改为文件夹,以查看是否存在问题– gerosalesc

It turns out it was an ownership issue. 原来这是所有权问题。 – user2548144 – user2548144

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM