Issue
How do I start/stop/restart Jenkins® or CloudBees CI?
Resolution
Administration from Jenkins
The easiest way to stop/restart a Jenkins instance is through the instance UI itself. In addition to the basic stop and restart commands, Jenkins provides a set of commands to safely stop/restart Jenkins by putting it in a quiet mode.
-
quietDown
: Put Jenkins in a Quiet mode, in preparation for a restart. In this mode, Jenkins stops executing new builds -
cancelQuietDown
: Cancel the Quiet mode -
safeRestart
: Jenkins will try to pause jobs and restart once all running jobs are either finished or paused. -
safeExit
: Jenkins will try to pause jobs and stop once all running jobs are either finished or paused.
Pipeline builds may prevent Jenkins from stopping/restarting for a short period of time in some cases, but if so, they will be paused at the next available opportunity and then resumed after Jenkins restarts. |
These URLs obey the security rules defined by the Authorization Strategy set up in Jenkins. Only users with the required permission can use the following URLs:
INSTANCE_URL/restart INSTANCE_URL/safeRestart INSTANCE_URL/exit INSTANCE_URL/safeExit INSTANCE_URL/quietDown INSTANCE_URL/cancelQuietDown
Remote API
These URLs can be invoked by a Remote API.
Using wget:
wget --user=USER --password=TOKEN INSTANCE_URL/restart wget --user=USER --password=TOKEN INSTANCE_URL/safeRestart wget --user=USER --password=TOKEN INSTANCE_URL/exit wget --user=USER --password=TOKEN INSTANCE_URL/safeExit wget --user=USER --password=TOKEN INSTANCE_URL/quietDown wget --user=USER --password=TOKEN INSTANCE_URL/cancelQuietDown
Using curl:
curl -X POST -u USER:TOKEN INSTANCE_URL/restart curl -X POST -u USER:TOKEN INSTANCE_URL/safeRestart curl -X POST -u USER:TOKEN INSTANCE_URL/exit curl -X POST -u USER:TOKEN INSTANCE_URL/safeExit curl -X POST -u USER:TOKEN INSTANCE_URL/quietDown curl -X POST -u USER:TOKEN INSTANCE_URL/cancelQuietDown
Jenkins CLI
java -jar jenkins-cli.jar -s INSTANCE_URL restart java -jar jenkins-cli.jar -s INSTANCE_URL safe-restart java -jar jenkins-cli.jar -s INSTANCE_URL shutdown java -jar jenkins-cli.jar -s INSTANCE_URL safe-shutdown java -jar jenkins-cli.jar -s INSTANCE_URL quiet-down java -jar jenkins-cli.jar -s INSTANCE_URL cancel-quiet-down
System Administration
You can also start, stop, and restart the service using systemctl
(quiet-down is not available using these commands).
Only users with the required operating system permissions will be able to run the following commands:
Linux
CloudBees CI operations center:
sudo systemctl start cloudbees-core-oc sudo systemctl stop cloudbees-core-oc sudo systemctl restart cloudbees-core-oc
CloudBees CI client controller:
sudo systemctl start cloudbees-core-cm sudo systemctl stop cloudbees-core-cm sudo systemctl restart cloudbees-core-cm
Jenkins:
sudo systemctl start jenkins sudo systemctl stop jenkins sudo systemctl restart jenkins
If running CloudBees CI on Debian based Distributions, do not launch init.d scripts manually because it makes your service unreliable as it picks up the environment from the current user as opposed to a clean reliable blank environment that is set by systemd (systemctl ).
|