Jenkins deployment project execution SSH remote reboot - operational problems

Jenkins recently with the deployment of the project after the end of deployment starts Tomcat, have been unsuccessful, the Internet to find information that is jenkins after the execution of the script, I think the task is over, but the script to start the associated subroutine is still running. Since jenkins believe the task has ended, is over the construction of related derivative process. Add BUILD_ID according to the online help.
Before and after the investigation for nearly half a day, not good times. Later remembered shell script to restart tomcat under debug. So we find a problem.
Sometimes it is ready to open the tomcat log to see if sometimes not restart successfully open the log view with shell before restarting tomcat with jenkins. When you open the Log Viewer so that there will be more out of a process that contains tomcat, use the ps -ef | grep tomcat | grep -v "grep"|awk '{print$2}'command to view the tomcat process, the query result is:
Write pictures described here
Then output debug shell are:
Write pictures described here
problems in determining whether existing tomcat process leading to kill the process can not kill death process, re-deploy the project will not start tomcat, I can not see an error message.
The easiest way is to use the deployment Jenkins, NA shell view the log, then use the above command to view the process as follows:
Write pictures described here
When using jenkins deploy the project again, debugging result:
Write pictures described here
the normal restart.
Can also be used in other ways to solve this problem, view the log determine whether the process contains a process, if it contains nothing. Only perform operations for restarting the tomcat.
Or write in grep tomcat judgment on whether there is a specific path tomcat process, but this approach for multiple tomcat on a server need to prepare multiple scripts.

Published 46 original articles · won praise 13 · views 60000 +

Guess you like

Origin blog.csdn.net/luliuliu1234/article/details/80976847