从 Hudson 运行时 Tomcat 脚本不工作
我正在尝试运行一个在 Linux 上停止和启动 Tomcat 的脚本。
当我从命令行运行它时,它工作正常。但当我在 Jenkins/Hudson 作业中的“执行 Shell”构建步骤中运行相同的脚本时,它似乎不起作用。 Jenkins 不会报告任何错误,但如果我尝试访问 tomcat 页面,则会收到页面未找到错误。
所以詹金斯似乎能够停止服务器,但无法将其恢复。
我将不胜感激任何帮助。
I'm trying to run a script which stops and starts Tomcat on linux.
When I run it from the command line it works fine. But it does not seem to work when I run the same script from the "Execute Shell" build step in a Jenkins/Hudson job. Jenkins doesn't report any errors but if I try going to the tomcat page then I get a page not found error.
So Jenkins seems able to stop the server, but not bringing it back up.
I'd be grateful for any help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试在“shell 执行”块中取消设置 BUILD_ID。在这种情况下,您甚至可能不需要使用
nohup
Try unsetting the BUILD_ID in your 'shell execute' block. You might even not need to use
nohup
in this case如果没有看到您的脚本,很难给出准确的答案。但是,您可以尝试将以下内容添加到脚本的开头(假设它是 bash 脚本):
您还可以尝试添加
以使 shell 在命令返回错误状态时立即退出。
如果 Hudson 看起来好像正在杀死 Tomcat 那么你可能想在 nohup 中运行它(如果你还没有这样做):
Without seeing your script it is difficult to give an exact answer. However you could try adding the following to the start of your script (assuming it is a bash script):
You could also try adding
to make the shell exit immediately if a command returns an error status.
If it looks as though Hudson is killing off Tomcat then you might want to run it within nohup (if you're not already doing that):