Jenkins启动项目后台进程自动杀掉

set BUILD_ID=dontKillMe 


start *****.bat 


问题:

I have a Hudson job that launches a .bat script file that itself launches my Jonas application server and a couple of other tasks too.


The script is properly launched from Hudson on my slave, then my application server is started but at the moment my Hudson job ends the application server is killed. This is due to the fact that all the processes launched during this process share the same pipes (stdin/sdtout/stderr) as explained herehttp://wiki.hudson-ci.org/display/HUDSON/Spawning+processes+from+build.


As you already understood, this is really not what I want! Actually I have another Hudson job that is launched right after the one I described above to test my application. Thus, as my application server has been killed at the same moment the Hudson jobs ended, my tests cannot run at all...


So how can I solve this?


This problem is strictly linked to the fact that it is Hudson that launches the script, if I launch the same script from the command line the problem does not occur at all...


In the link given above they propose to use the "at" command which allows to schedule a task in Windows. I don't really want to use this solution as this implies modifications in my .bat script because I launch it from Hudson.


I suppose there is a way to say to my .bat file "Ok you are going to launch my application server BUT in an independent process". Do you guys know how to do this?
Maybe Hudson is able to solve this issue? Do you Hudson's guys know how?
Thanks in advance for you help!


国外网友回答问题:


The best practice here is to clear the environment variable BUILD_ID. When cleaning up after a build job, Hudson looks at the BUILD_ID environment variable in each process, to kill off any lingering processes. So by clearing that environment variable, Hudson will not kill the process.




shareimprove this answer
answered Oct 2 '09 at 14:30




Michael Donohue
10.2k42043
 
Thanks for your input! I saw you are kind of a Hudson guru in your profile ;) Should I clear the BUILD_ID variable or should I set it to BUILD_ID=dontKillMe as I saw on the link wiki.hudson-ci.org/display/HUDSON/Spawning+processes+from+build? – reef Oct 2 '09 at 14:34
 
Hudson bug reported hudson.dev.java.net/issues/show_bug.cgi?id=3105. – reef Oct 2 '09 at 14:55
 
Setting BUILD_ID environment variable in Hudons to dontKillMe works fine, but as explained in the reported bug (link above) this is a workaround. I will post the solution once the bug fixed. Thanks!! – reef Oct 2 '09 at 15:07
 
Setting BUILD_ID is not a workaround, it is the currently recommended solution. – Michael Donohue Oct 5 '09 at 14:52
 
This approach doesn't work with all applications, however. Weblogic 8.1, for example, bombed out big time with BUILD_ID=dontKillMe. – jcelgin Feb 10 '10 at 17:11
show 1 more comment

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值