How to Restart Jenkins in Linux, Windows, Mac? [4 Methods]
By Mayank Modi
Updated on Apr 28, 2025 | 10 min read | 26.61K+ views
Share:
Table of Contents
View all
While working on Jenkins, there might be instances when you need to go for Jenkins restart. Right from troubleshooting an error to installing some new Jenkins plugin, there can be various reasons why you need to restart it. However, if you are starting your days with Jenkins and do not have a complete overview of the methods you need to use on how restart Jenkins manually, I have got you covered. This article comprises Jenkins tutorial to aid you in learning about ways for safe restarting Jenkins. If you want to know more about how to restart Jenkins and its different functionalities, you must check out some Jenkins course online.
Whether you're a beginner or an experienced DevOps engineer, knowing how to restart Jenkins in Windows is a fundamental skill when managing CI/CD pipelines.
Master the Right Skills & Boost Your Career
Avail your free 1:1 mentorship session
Different Ways to Restart Jenkins
As I mentioned earlier, there are multiple ways to restart Jenkins. You can use the URL bar, a safe restart plugin or use the Manage Jenkins tab available on the UI to restart Jenkins on your computer.
We can segregate Jenkins restart into two different categories. The first method is a safe restart, while the other is a Jenkins force restart, which skips waiting for running builds to finish. When you use a restart command directly on the URL, Jenkins restarts instantly without completing the build that is processing. In comparison, safe restarting allows Jenkins to complete the running builds and prepare them for the restart.
Whether you're using the dashboard, a plugin, or CLI, knowing how to restart Jenkins correctly ensures builds aren’t disrupted unexpectedly.
Users can safely restart Jenkins through the Safe Restart plugin and Manage Jenkins.
Using Manage Jenkins
One can shut down and restart Jenkins using Manage Jenkins. The option to 'safe shutdown' Jenkins is available in the Tools and action section under the Manage Jenkins option. It allows you to shut down Jenkins modules safely. Using the option, Jenkins stops processing any new build and prepares for the shutdown.
- Follow the steps below to understand the process completely.
- First login to Jenkins
- Then, select the 'Manage Jenkins' option from the left-hand side menu.
- Now, scroll down and click on the 'Prepare for Shutdown' tab under 'Tools and Shutdown.'
These steps show how to restart Jenkins through its built-in dashboard safely without interrupting ongoing processes.
Note: As you click the Prepare for Shutdown button, Jenkins will wait for the execution of the builds that are running and stop executing any new build. After clicking the Prepare for Shutdown button, you will be redirected to the Jenkins dashboard. Also, you will be shown a notification like the below image.
How to Restart Jenkins Manually?
1. Restart Jenkins via URL
Are you accessing the Jenkins dashboard from a web browser? If so, here’s how to restart Jenkins directly through the URL bar using a simple command. Use the following command on the URL to force restart Jenkins. It will stop Jenkins from executing any build that is running and restarts right at the time.
[Jenkins URL]/restart
Now, if you want to safely restart Jenkins, which means allowing Jenkins to execute all the builds that are running the command is a bit different. Use the following command on the URL to perform a Jenkins force restart. This will immediately restart Jenkins without waiting for running builds to be completed.
[Jenkins URL]/safeRestart
After executing any of the commands, you will be redirected to the dashboard and a notification window asking for confirmation. Click the Yes button to complete the restart.
The port on which Jenkins is running on your system and the hostname are available on the Jenkins URL. The default port for Jenkins to run is '8080'.
If you are logging in to Jenkins from your system, then you can use the following command on the URL bar:
http://localhost:8080/restart
http://localhost:8080/safeRestart
However, if you are logging in from another system, then use these commands to restart Jenkins manually:
http://[your system's hostname]:8080/restart
http://[your system's hostname]:8080/safeRestart
2. Restart Jenkins via Safe Restart Plugin
As we mentioned earlier, you can safely restart Jenkins from the Safe Restart Plugin. If you already have the plugin installed, you can restart Jenkins straight from the dashboard left menu bar.
However, if you have not installed the plugin yet, you can follow the steps below to install it.
- Log in to Jenkins, and from the left menu bar on the dashboard, click on Manage Jenkins.
- Now, go to the System Configuration and select Manage Plugins.
- Then, as the Plugin Manager window opens, click on the Available tab.
- Now, on the search bar, type 'Safe restart.' From the search result, tick the box beside the plugin name.
- Then add the plugin by clicking on the Install without restart button.
- After installing the plugin, go back to the dashboard and click on the Restart Safely tab on the left.
- Finally, you will get a notification asking for confirmation to restart Jenkins. Click Yes to proceed with the restart.
3. Restart Jenkins via CLI
Jenkins command line interface is built on Java and works as an add-on to the user's native terminal shell. From the CLI, you can use Java commands to manage Jenkins. With that being said, users can restart Jenkins from the CLI itself.
You will be able to learn more about Jenkins and its CLI functions by participating in DevOps certification online courses.
However, if you want to use Jenkins CLI to restart its functions, you must check out the steps below,
- In the first step, download the .jar file of the Jenkins CLI.
- Now, open the Jenkins dashboard on your browser and click on the Manage Jenkins tab from the left-hand side menu bar.
- Next, scroll down to the Tools and Actions section and click the Jenkins CLI button.
- Download the Jenkins-cli.jar
- As the download completes, open the terminal window and run the below-mentioned syntax to restart Jenkins.
Using the CLI gives you more control, including the ability to trigger a Jenkins force restart directly from your terminal.
java -jar [path to the jenkins-cli.jar file] -s [Jenkins URL] restart
Prerequisites for Manually Restarting Jenkins
Before restarting Jenkins manually, it’s a good idea to check a few things to make sure everything goes smoothly. These aren't complicated steps but skipping them can lead to unnecessary issues.
First, make sure you access the Jenkins dashboard and that you have admin rights. Regular users won’t be able to restart the system, so you’ll need proper permissions.
Next, use a reliable web browser like Chrome, Firefox, Safari, or Edge. Jenkins works best on these and using an outdated or unsupported browser might cause interface glitches.
Also, Jenkins should already be installed on the machine or server you're working with. If it’s not set up yet, you’ll need to install it first. Installation steps vary depending on the operating system, so follow the relevant guide for Windows, CentOS, or whichever OS you're using.
Verifying installation is especially important if you plan to use commands like the Jenkins restart service from the system terminal.
Don’t forget your Jenkins credentials. You’ll need a valid username and password to log in, especially since admin tasks like restarting require higher-level access.
And while not mandatory, having a stable internet connection helps. You don’t want to lose access halfway through the restart process.
Once you’ve ticked off all these boxes, you’re all set to restart Jenkins without any hiccups.
How to Restart Jenkins in Windows, Linux, and Mac?
After installing Jenkins on your system, it runs as a background process, making Jenkins service restart a straightforward task using platform-specific commands. Therefore, you can easily restart Jenkins on your Linux, Windows, and Mac computer by following the simple commands you follow while restarting other services. Below, we’ve listed platform-specific commands that show you exactly how to restart Jenkins in Linux, Windows, and macOS environments.
A. Restart Jenkins in Linux
Run the following syntax on your Linux terminal to restart Jenkins:
sudo systemctl restart Jenkins
This command initiates a clean Jenkins service restart, shutting down the current process and launching a fresh one without affecting the underlying system.
B. Restart Jenkins in Windows
There are two ways to restart Jenkins running on a Windows PC. Here are the steps that you need to follow,
- On your Windows computer, open the Command Prompt with administrative rights.
- Then, run the following command to restart Jenkins on Windows.
Both approaches ensure a reliable Jenkins service restart on Windows, whether you’re using Command Prompt or restarting the executable directly.
net stop Jenkins
net start Jenkins
Apart from that, there is another way that you can follow to complete the restart process. Here, you need to use a command that allows you to move to the installation folder and restart the .exe program running for Jenkins. Follow the command below to restart Jenkins on Windows using this command.
cd C:\Program Files\Jenkins
jenkins.exe restart
C. Restart Jenkins in MacOS
On macOS, using “launchctl” is the most effective way to perform a Jenkins service restart without disrupting system processes. Follow the commands here,
sudo launchctl unload /Library/LaunchDaemons/org.Jenkins-ci.plist
Restart Jenkins Stages
Along with knowing how to restart Jenkins, it’s also helpful to learn how to restart specific pipeline stages once a build has completed or failed. You can do it from the Jenkins classic UI or the Blue Ocean UI itself. Here is how to do it:
1. Restarting from the Classic UI
Follow the steps below to restart from stages on Jenkins:
- As your Pipeline completes, go to the side panel on the classic UI.
- Next, locate the Restart from Stage button and click on it.
- After that, you will get a list of top-level stages to choose from. Select the stage from where you want to restart.
As you select the stage to restart, a new build will be assigned with a new build number. Also, the previous stages will be excluded, and the Pipeline will execute the selected stage. The Pipeline will start running normally from that point.
Note: The list will show you only the top-level stages that were run originally following the same execution order. Also, it won't show you the skipped stages because of an earlier failure.
However, you will find the skipped stages because of a condition not being satisfied. The list of unavailable stages also includes the parent stage for a group of parallel stages. Along with that, the group nested stages that were supposed to be running sequentially will also be unavailable.
2. Restarting from the Blue Ocean UI
Though it's possible to restart stages from the classic UI, the Blue Ocean Plugin offers a clear and intuitive UI. It makes it easy for the users to view pipeline stages. Follow the steps below to restart Jenkins stages through Blue Ocean UI:
- Firstly, access your project's CI service page.
- Then, select the Open Blue Ocean option from the left menu to find your project's Pipeline.
- Now, select the Pipeline and click on the build you want to restart.
- Then, you have to select the stage from which you want to restart.
- Finally, it will start a new Jenkins run that starts from the stage that you have selected with the same commit information as it is based on.
While this method focuses on restarting individual stages, it’s still useful to know when a full Jenkins restart service might be necessary to clear system-wide issues.
Also, similar to the previous process a new description will be generated that identifies the preceding run for the build.
Conclusion
Now that I've walked you through the manual restart process and other methods on how to restart Jenkins, I hope you won't encounter difficulties in the future. It will now be easier for you to restart Jenkins in Linux, Windows, and Mac. However, if you need more information on Jenkins and how it works, then KnowledgeHut's Jenkins course online can be exclusively beneficial to you. This online course will help you understand Jenkins, Jenkins restart command and its operation much better.
Frequently Asked Questions (FAQs)
1. How to safely restart Jenkins?
You can use the safe restart command on the Jenkins URL, the Manage Jenkins tab, or a safe restart plugin to safely restart Jenkins. Simply follow one of the methods mentioned in the article, and you can easily complete the task.
2. How do you rerun a pipeline in Azure DevOps?
It is pretty straightforward when it comes to running a pipeline in Azure DevOps all over again. Simply follow the steps that we have mentioned below,
- Click on the Up and Down arrow on the stage box available in the pipeline window.
- Now, locate and click on the Rerun button to run the particular stage.
3. How do I keep the Jenkins pipeline after a host reboot?
You can change sudo reboot to sudo shutdown -r +m5, or whatever delay you require would prevent the Pipeline from failing. The command separates the reboot process from the system and allows the Jenkins agent to complete the Pipeline cleanly. Thus, you can find it even after a host reboot.
4. Can I use Jenkins force restart during active builds?
Technically, yes, but it's not recommended. A Jenkins force restart will immediately shut down Jenkins, possibly interrupting builds in progress. Use safe restart methods instead to ensure all jobs finish cleanly.
5. What’s the easiest way to restart Jenkins in Windows?
The easiest way to restart Jenkins in Windows is by using the Command Prompt with administrative rights. You can also restart it by stopping and restarting the Jenkins service via services.msc or through the installation folder using .exe commands.
6. What is the Jenkins restart service command for Linux?
The most common Jenkins restart service command on Linux is sudo systemctl restart jenkins, which safely stops and starts the Jenkins process using systemd.
7. Can I automate the Jenkins restart service during deployments?
Yes, many DevOps teams include the Jenkins restart service command in their deployment scripts to apply configuration changes or plugin updates as part of the release process.
86 articles published
Mayank Modi is a Red Hat Certified Architect with expertise in DevOps and Hybrid Cloud solutions. With a passion for technology and a keen interest in Linux/Unix systems, CISCO, and Network Security, ...
Get Free Consultation
By submitting, I accept the T&C and
Privacy Policy
Preparing to hone DevOps Interview Questions?
