How to restart Jenkins manually?
Ahmet KARA
AWS Certificate Cloud Engineer | Kubernetes | Terraform | Linux | Jenkins | Docker | Git | Grafana | Prometheus | Ansible | Python | Maven | Vault | Nginx | Networking | Bash Scripting | Architecture Design
To restart Jenkins manually, you can use either of the following commands (by entering their URL in a browser):
(jenkins_url)/safeRestart?- Allows all running jobs to complete. New jobs will remain in the queue to run after the restart is complete.
(jenkins_url)/restart?- Forces a restart without waiting for builds to complete.
For safeRestart, java -jar /var/cache/jenkins/war/WEB-INF/jenkins-cli.jar -s https://localhost:8080/ safe-restart?(if installed by rpm or deb, otherwise adjust accordingly).
This causes a?RestartNotSupportedException?in Jenkins 1.532.1 with IcedTea 2.3.9.?sudo /etc/init.d/jenkins restart?can be work.
In Windows, use the Windows service rather than the command line.
Tip: if you are using the Workflow plugin,?restart?will not kill running Workflow builds. In version 1.8 or later (requires Jenkins 1.609.1 or later),?safeRestart?will also go ahead and restart Jenkins even while Workflow builds are in progress (after any “traditional” builds complete)
Is this not available in the web gui?
Be aware if Jenkins is deployed as a ".war" file within a running Tomcat, a Jenkins restart also restarts any other .war files in that Tomcat instance.
On Ubuntu or Debian, when installed through?apt-get/dpkg:
$ sudo /etc/init.d/jenkins restart
Usage: /etc/init.d/jenkins {start|stop|status|restart|force-reload}