Jenkins seems to be the target for nohup in a script started via ssh, how can I prevent that?

前端 未结 4 483
暗喜
暗喜 2021-01-14 00:35

I am trying to create a Jenkins job that restarts a program that runs all the time on one of our servers.

I specify the following as the command to run:



        
4条回答
  •  庸人自扰
    2021-01-14 01:10

    In the new Pipeline jobs, setting BUILD_ID no longer prevents Jenkins from killing your processes once the job finishes. Instead, you need to set JENKINS_NODE_COOKIE:

    sh 'JENKINS_NODE_COOKIE=dontKillMe nohup java NameOfClass &'
    

    See the wiki on ProcessTreeKiller and this comment in the Jenkins Jira for more information.

提交回复
热议问题