Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
200 views
in Technique[技术] by (71.8m points)

How to stop running java process and rerun it from Jenkins in centOS

My goal is to setup a CI/DI pipe line in Jenkins for Java Spring Boot project. I am using maven and git. I am able to automate the compile, test and package, after any push to the GitHub. But I am unable to automate the deployment by "java -jar <path/appName>" command. I have searched, they are many solutions.

To run run the application in the Background I am tmux. But I am unable to kill current java application. I have running other Java applications. Some of the solutions are in the intermate is that jus kill the all java process.

What I need to do:

  1. have to do compile, test, package

  2. have to kill the current running java application. my running application command is </var/lib/jenkins/workspace/app-package/target/app-0.0.1-SNAPSHOT.jar>. How to kill this program? Is there any to kill it by command name? I can find out the job id by command name in terminal.

  3. have to rerun the </var/lib/jenkins/workspace/app-package/target/app-0.0.1-SNAPSHOT.jar> command in Background. want to avoid tmux.

I am able to do task One but totally with stacked with task Two. For task Three, I am unable to run the process in Background by tmux from Jenkins. But unable to use tmux from Jenkins.

If i run ps -A | grep java

Out Put:

23053 ?        00:21:08 java
716890 pts/2    00:00:52 java

It is showing two process, in automated situation, how it will be determined which one have to kill? Which process is running by the command </var/lib/jenkins/workspace/app-package/target/app-0.0.1-SNAPSHOT.jar>?

question from:https://stackoverflow.com/questions/65641123/how-to-stop-running-java-process-and-rerun-it-from-jenkins-in-centos

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...