Users could run into a circumstance where they need to manually restart Jenkins while using it. How to Restart Jenkins Manually? This could happen for a variety of reasons, such adding plugins or debugging problems. Jenkins, fortunately, provides a number of ways to carry out a manual restart.
In this article, we’ll go over the various techniques for manually restarting Jenkins.
- A fully functional installation of Jenkins (learn how to install Jenkins on Ubuntu 18.04, Debian 10, CentOS 8, or Windows 10).
- Having the use of a web browser
- Access to the command prompt or terminal window (Linux and macOS) (Windows).
- The ability to access a user account with sudo/administrator rights.
Restart Jenkins via URL
Enter the correct URL to restart Jenkins if you are using the Jenkins dashboard in a web browser. Jenkins will restart if you use the default restart URL without waiting for any builds to finish:
restart at [Jenkins URL]
Use the safe restart option to finish all open jobs before the restart. Once the restart is complete, new jobs will start to queue up and run:
/safe Restart Jenkins URL
How to Restart Jenkins Manually? Both choices necessitate hitting the Yes button to confirm the restart:
The system’s hostname and the port Jenkins is executing on are both included in the Jenkins URL (default port is 8080). When logging into your system’s Jenkins dashboard, use:
http://localhost:8080/restart
http://localhost:8080/saferestart
Use: to sign in if you are using a different system.
http://[your system's hostname]:8080/restart
http://[your system's hostname]:8080/safe Restart
Restart Jenkins via Safe Restart Plugin
You may do a safe restart from the Jenkins dashboard thanks to the Safe Restart plugin for Jenkins.
- To begin adding the plugin, click the Manage Jenkins option on the dashboard’s left side:
- Select Manage Plugins from the System Configuration section:
- Find “safe restart” under the Available tab and select the Safe Restart plugin by checking the box next to its name.
- To add the plugin, click the Install without restart option as follows:
- Return to your dashboard when the plugin has been installed. On the left side, a new link labeled “Restart Safely” has appeared:
- Clicking the link starts a secure Jenkins restart. Clicking the Yes option will require you to confirm the restart:
CLI restart Jenkins
A Java file called Jenkins CLI (Command Line Interface) functions as an addition to the local terminal shell. From a terminal window or command prompt, you may control Jenkins using Java commands.
1: Download the Jenkins CLI.jar file first
2: Click the Manage Jenkins link on the left-hand side of the Jenkins dashboard once it has loaded in your web browser.
3: In the Tools and Actions area, scroll down and select the Jenkins CLI button.
4: Download Jenkins-cli.jar using the provided link.
5: To restart Jenkins after the download is finished, open a terminal window or command prompt and enter the following commands:
restarting Java using the command java -jar [path to the jenkins-cli.jar file]
For instance, using a Windows computer with the jenkins-cli.jar file in the Downloads folder:
Restart with the command: java -jar C:UsersakovaDownloadsjenkins-cli.jar -s http://localhost:8080
How to Restart Jenkins on Windows, Linux, and Mac?
How to Restart Jenkins Manually? Jenkins starts up as a background service after installation. It can therefore be restarted using the same instructions as other services.
Restart the Linux Jenkins Service.
Start the Jenkins service restart on a Linux computer by typing:
systemctl restart Jenkins with sudo
Another approach is to apply:
restart Jenkins with sudo /etc/init. d
Restart the Jenkins Service in Windows
How to Restart Jenkins Manually? Use the net command to stop and then restart the Jenkins service on the Windows command prompt:
jenkins, net stop
start net jenkins
Restarting Jenkins.exe by going to the installation folder for Jenkins is another option. For illustration:
Jenkins, program files at C:
start jenkins.exe
Restart MacOS’s Jenkins service.
How to Restart Jenkins Manually? Use the launchctl command to stop and start the Jenkins service twice on MacOS to restart it:
/Library/LaunchDaemons/org.jenkins-ci.plist sudo launchctl unload
/Library/LaunchDaemons/org.jenkins-ci.plist sudo launchctl load
Conclusion
After reading this guide, you have to be able How to Restart Jenkins Manually? using one of the techniques described above.