I need to get PID & Port# for a Jenkins process run. If i get that PID, i can kill the process if ever i need to.
I am running the Jenkins process by below commands:
java -jar jenkins.war
Sometimes, Jenkins Process fail to start if that port is taken and below occurs:
Jenkins home directory: /Users/MacPro/.jenkins found at: $user.home/.jenkins
Feb 27, 2016 10:46:09 AM org.eclipse.jetty.util.log.JavaUtilLog warn
WARNING: FAILED
[email protected]:8080:java.net.BindException:
Address already in use
java.net.BindException: Address already in use
And I know how to run the jenkins process against a specific Port#.
Need to know the commands for which PID and the port, current job is using.
The command will be below:
ps -ef| grep jenkins
It will display the process id.
Answer to your question 1) In Unix box, the command usage will be ps -ef| grep jenkins, it will display the process id (pid) 2) kill -9 (pid)
This should do the job. Better to find and kill using the same command, saves time:
ps -Af | grep "jenkins" | grep -v grep | awk '{print$2}' | xargs kill -9
You can check the process before killing
ps -Af | grep "jenkins" | grep -v grep | awk '{print$2}'
If you are running Jenkins using tomcat
ps -Af | grep "tomcat" | grep -v grep | awk '{print$2}' | xargs kill -9
Please note that these commands tested on RHEL.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With