ssh plugin terminates and kills my daemon process

175 views
Skip to first unread message

Eric Wood

unread,
Jan 21, 2015, 1:47:06 PM1/21/15
to Jenkinsci-users
I'm using a ssh plugin to start a tomcat server. 

I call a command that ends up calling the tomcat startup shell script.  Once the call to the startup script is made I call an additional script in the same ssh execution that  goes out and runs a curl command to see when the server is responding with a 200 status code.  Once that happens, I terminate the ssh connection.  At this point it seems to kill the tomcat server.  I can tail the catalina.out file and see when the server starts and then shuts down.  

What is the proper process for keeping this process alive?


Eric Wood

unread,
Jan 21, 2015, 2:41:53 PM1/21/15
to jenkins...@googlegroups.com
I have read on processtreekiller.  according to the wiki:

If your build wants to leave a daemon running behind...

A convenient way to achieve that is to change the environment variable BUILD_ID which Jenkins's ProcessTreeKiller is looking for. This will cause Jenkins to assume that your daemon is not spawned by the Jenkins build. For example:
BUILD_ID=dontKillMe /usr/apache/bin/httpd

Is this something that I embed in the script that I am calling from my Jenkins ssh build step.  As I said I call a script that calls the startup.sh script.  Do I add the BUILD_ID=dontKillMe in front of the startup.sh call






--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/44378829.2770454.1421866017276.JavaMail.yahoo%40jws10036.mail.ne1.yahoo.com.
For more options, visit https://groups.google.com/d/optout.


Eric Pyle

unread,
Jan 21, 2015, 2:54:14 PM1/21/15
to jenkins...@googlegroups.com
Perhaps you need to start the tomcat server with nohup?

Eric Wood

unread,
Jan 21, 2015, 4:25:09 PM1/21/15
to jenkins...@googlegroups.com
I'm running the command as follows:

sudo nohup /apps/Config/usr/local/bin/ec2-init dev start > /dev/null 2>&1 & 

After this command runs I call another that is calling the application and waiting to get a 200 http status code back.  After a few minutes of getting "503", I eventually get a "200" and the build step terminates, then I can see the catalina.out file indicate that the application is shutting down.




Reply all
Reply to author
Forward
0 new messages