To restart Jenkins we have various way. Few are with url and few with the help of plugin. Let see all possible ways to restart jenkins.
Table of Contents
1. Using url
<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.
Example
http://localhost:8080/safeRestart http://localhost:8080/restart
2. Using Plugin
The SafeRestart Plugin allows you to restart Jenkins safely: it’s waiting that all builds in progress finished before launching restart.
3. Jenkin Service
For Linux base OS:
- To know the status
sudo service jenkins status
- To start
sudo service jenkins start
- To stop
sudo service jenkins stop
- To restart
sudo service jenkins restart
For CentOS:
- To stop
sudo systemctl stop Jenkins
- To start
sudo systemctl start Jenkins
- To restart
sudo systemctl restart Jenkins
For Window:
- To stop
jenkins.exe stop
- To start
jenkins.exe start
- To restart
jenkins.exe restart
For MacOS:
- To stop
sudo launchctl unload /Library/LaunchDaemons/org.jenkins-ci.plist
- To restart
sudo launchctl load /Library/LaunchDaemons/org.jenkins-ci.plist
4. Using CLI
java -jar jenkins-cli.jar -s <jenkin_url> restart
5. For Window If service installed
Run services.msc
or Open Task manager go to service tab and search Jenkins
Service and restart: