Reputation: 4342
I run Jenkins in its own container. I use the command "nohup java -jar jenkins.war --httpsPort=8443".
How do I shut it down safely? Right now, I use the kill command to kill the process.
Upvotes: 92
Views: 205324
Reputation: 1158
Upvotes: 31
Reputation: 6609
Immediately shuts down Jenkins server.
In Windows CMD.exe
, Go to folder where jenkins-cli.jar
file is located.
C:\Program Files (x86)\Jenkins\war\WEB-INF
Use Command to Safely Shutdown
java -jar jenkins-cli.jar -s http://localhost:8080 safe-shutdown --username "YourUsername"
--password "YourPassword"
The full list of commands is available at http://localhost:8080/cli
Credits to Francisco post for cli
commands.
Reference:
Hope helps someone.
Upvotes: 1
Reputation: 7325
You can also look in the init script area (e.g. centos vi /etc/init.d/jenkins ) for details on how the service is actually started and stopped.
Upvotes: 2
Reputation: 16971
Create a Jenkins Job that runs on Master:
java -jar "%JENKINS_HOME%/war/WEB-INF/jenkins-cli.jar" -s "%JENKINS_URL%" safe-restart
Upvotes: 2
Reputation: 1736
If you would like to stop jenkins and all its services on the server using Linux console (e.g. Ubuntu), run:
service jenkins start/stop/restart
This is useful when you need to make an image/volume snapshot and you want all services to stop writing to the disk/volume.
Upvotes: 67
Reputation: 1577
Use http://[jenkins-server]/exit
This page shows how to use URL commands.
Upvotes: 132
Reputation: 4110
The full list of commands is available at http://your-jenkins/cli
The command for a clean shutdown is http://your-jenkins/safe-shutdown
You may also want to use http://your-jenkins/safe-restart
Upvotes: 25
Reputation: 11075
You can kill Jenkins safely. It will catch SIGTERM and SIGINT and perform an orderly shutdown. However, if Jenkins was in the middle of building something, it will abort the builds and they will show up gray in the status display.
If you want to avoid this, you must put Jenkins into shutdown mode to prevent it from starting new builds and wait until currently running builds are done before killing Jenkins.
You can also use the Jenkins command line interface and tell Jenkins to safe-shutdown, which does the same. You can find more info on Jenkins cli at http://YOURJENKINS/cli
Upvotes: 8
Reputation: 21130
Yes, kill should be fine if you're running Jenkins with the built-in Winstone container. This Jenkins Wiki page has some tips on how to set up control scripts for Jenkins.
Upvotes: 19