Explore Courses
course iconScrum AllianceCertified ScrumMaster (CSM) Certification
  • 16 Hours
Best seller
course iconScrum AllianceCertified Scrum Product Owner (CSPO) Certification
  • 16 Hours
Best seller
course iconScaled AgileLeading SAFe 6.0 Certification
  • 16 Hours
Trending
course iconScrum.orgProfessional Scrum Master (PSM) Certification
  • 16 Hours
course iconScaled AgileSAFe 6.0 Scrum Master (SSM) Certification
  • 16 Hours
course iconScaled Agile, Inc.Implementing SAFe 6.0 (SPC) Certification
  • 32 Hours
Recommended
course iconScaled Agile, Inc.SAFe 6.0 Release Train Engineer (RTE) Certification
  • 24 Hours
course iconScaled Agile, Inc.SAFe® 6.0 Product Owner/Product Manager (POPM)
  • 16 Hours
Trending
course iconKanban UniversityKMP I: Kanban System Design Course
  • 16 Hours
course iconIC AgileICP Agile Certified Coaching (ICP-ACC)
  • 24 Hours
course iconScrum.orgProfessional Scrum Product Owner I (PSPO I) Training
  • 16 Hours
course iconAgile Management Master's Program
  • 32 Hours
Trending
course iconAgile Excellence Master's Program
  • 32 Hours
Agile and ScrumScrum MasterProduct OwnerSAFe AgilistAgile CoachFull Stack Developer BootcampData Science BootcampCloud Masters BootcampReactNode JsKubernetesCertified Ethical HackingAWS Solutions Artchitct AssociateAzure Data Engineercourse iconPMIProject Management Professional (PMP) Certification
  • 36 Hours
Best seller
course iconAxelosPRINCE2 Foundation & Practitioner Certificationn
  • 32 Hours
course iconAxelosPRINCE2 Foundation Certification
  • 16 Hours
course iconAxelosPRINCE2 Practitioner Certification
  • 16 Hours
Change ManagementProject Management TechniquesCertified Associate in Project Management (CAPM) CertificationOracle Primavera P6 CertificationMicrosoft Projectcourse iconJob OrientedProject Management Master's Program
  • 45 Hours
Trending
course iconProject Management Master's Program
  • 45 Hours
Trending
PRINCE2 Practitioner CoursePRINCE2 Foundation CoursePMP® Exam PrepProject ManagerProgram Management ProfessionalPortfolio Management Professionalcourse iconAWSAWS Certified Solutions Architect - Associate
  • 32 Hours
Best seller
course iconAWSAWS Cloud Practitioner Certification
  • 32 Hours
course iconAWSAWS DevOps Certification
  • 24 Hours
course iconMicrosoftAzure Fundamentals Certification
  • 16 Hours
course iconMicrosoftAzure Administrator Certification
  • 24 Hours
Best seller
course iconMicrosoftAzure Data Engineer Certification
  • 45 Hours
Recommended
course iconMicrosoftAzure Solution Architect Certification
  • 32 Hours
course iconMicrosoftAzure Devops Certification
  • 40 Hours
course iconAWSSystems Operations on AWS Certification Training
  • 24 Hours
course iconAWSArchitecting on AWS
  • 32 Hours
course iconAWSDeveloping on AWS
  • 24 Hours
course iconJob OrientedAWS Cloud Architect Masters Program
  • 48 Hours
New
course iconCareer KickstarterCloud Engineer Bootcamp
  • 100 Hours
Trending
Cloud EngineerCloud ArchitectAWS Certified Developer Associate - Complete GuideAWS Certified DevOps EngineerAWS Certified Solutions Architect AssociateMicrosoft Certified Azure Data Engineer AssociateMicrosoft Azure Administrator (AZ-104) CourseAWS Certified SysOps Administrator AssociateMicrosoft Certified Azure Developer AssociateAWS Certified Cloud Practitionercourse iconAxelosITIL 4 Foundation Certification
  • 16 Hours
Best seller
course iconAxelosITIL Practitioner Certification
  • 16 Hours
course iconPeopleCertISO 14001 Foundation Certification
  • 16 Hours
course iconPeopleCertISO 20000 Certification
  • 16 Hours
course iconPeopleCertISO 27000 Foundation Certification
  • 24 Hours
course iconAxelosITIL 4 Specialist: Create, Deliver and Support Training
  • 24 Hours
course iconAxelosITIL 4 Specialist: Drive Stakeholder Value Training
  • 24 Hours
course iconAxelosITIL 4 Strategist Direct, Plan and Improve Training
  • 16 Hours
ITIL 4 Specialist: Create, Deliver and Support ExamITIL 4 Specialist: Drive Stakeholder Value (DSV) CourseITIL 4 Strategist: Direct, Plan, and ImproveITIL 4 Foundationcourse iconJob OrientedData Science Bootcamp
  • 6 Months
Trending
course iconJob OrientedData Engineer Bootcamp
  • 289 Hours
course iconJob OrientedData Analyst Bootcamp
  • 6 Months
course iconJob OrientedAI Engineer Bootcamp
  • 288 Hours
New
Data Science with PythonMachine Learning with PythonData Science with RMachine Learning with RPython for Data ScienceDeep Learning Certification TrainingNatural Language Processing (NLP)TensorflowSQL For Data Analyticscourse iconIIIT BangaloreExecutive PG Program in Data Science from IIIT-Bangalore
  • 12 Months
course iconMaryland UniversityExecutive PG Program in DS & ML
  • 12 Months
course iconMaryland UniversityCertificate Program in DS and BA
  • 31 Weeks
course iconIIIT BangaloreAdvanced Certificate Program in Data Science
  • 8+ Months
course iconLiverpool John Moores UniversityMaster of Science in ML and AI
  • 750+ Hours
course iconIIIT BangaloreExecutive PGP in ML and AI
  • 600+ Hours
Data ScientistData AnalystData EngineerAI EngineerData Analysis Using ExcelDeep Learning with Keras and TensorFlowDeployment of Machine Learning ModelsFundamentals of Reinforcement LearningIntroduction to Cutting-Edge AI with TransformersMachine Learning with PythonMaster Python: Advance Data Analysis with PythonMaths and Stats FoundationNatural Language Processing (NLP) with PythonPython for Data ScienceSQL for Data Analytics CoursesAI Advanced: Computer Vision for AI ProfessionalsMaster Applied Machine LearningMaster Time Series Forecasting Using Pythoncourse iconDevOps InstituteDevOps Foundation Certification
  • 16 Hours
Best seller
course iconCNCFCertified Kubernetes Administrator
  • 32 Hours
New
course iconDevops InstituteDevops Leader
  • 16 Hours
KubernetesDocker with KubernetesDockerJenkinsOpenstackAnsibleChefPuppetDevOps EngineerDevOps ExpertCI/CD with Jenkins XDevOps Using JenkinsCI-CD and DevOpsDocker & KubernetesDevOps Fundamentals Crash CourseMicrosoft Certified DevOps Engineer ExperteAnsible for Beginners: The Complete Crash CourseContainer Orchestration Using KubernetesContainerization Using DockerMaster Infrastructure Provisioning with Terraformcourse iconTableau Certification
  • 24 Hours
Recommended
course iconData Visualisation with Tableau Certification
  • 24 Hours
course iconMicrosoftMicrosoft Power BI Certification
  • 24 Hours
Best seller
course iconTIBCO Spotfire Training
  • 36 Hours
course iconData Visualization with QlikView Certification
  • 30 Hours
course iconSisense BI Certification
  • 16 Hours
Data Visualization Using Tableau TrainingData Analysis Using Excelcourse iconEC-CouncilCertified Ethical Hacker (CEH v12) Certification
  • 40 Hours
course iconISACACertified Information Systems Auditor (CISA) Certification
  • 22 Hours
course iconISACACertified Information Security Manager (CISM) Certification
  • 40 Hours
course icon(ISC)²Certified Information Systems Security Professional (CISSP)
  • 40 Hours
course icon(ISC)²Certified Cloud Security Professional (CCSP) Certification
  • 40 Hours
course iconCertified Information Privacy Professional - Europe (CIPP-E) Certification
  • 16 Hours
course iconISACACOBIT5 Foundation
  • 16 Hours
course iconPayment Card Industry Security Standards (PCI-DSS) Certification
  • 16 Hours
course iconIntroduction to Forensic
  • 40 Hours
course iconPurdue UniversityCybersecurity Certificate Program
  • 8 Months
CISSPcourse iconCareer KickstarterFull-Stack Developer Bootcamp
  • 6 Months
Best seller
course iconJob OrientedUI/UX Design Bootcamp
  • 3 Months
Best seller
course iconEnterprise RecommendedJava Full Stack Developer Bootcamp
  • 6 Months
course iconCareer KickstarterFront-End Development Bootcamp
  • 490+ Hours
course iconCareer AcceleratorBackend Development Bootcamp (Node JS)
  • 4 Months
ReactNode JSAngularJavascriptPHP and MySQLcourse iconPurdue UniversityCloud Back-End Development Certificate Program
  • 8 Months
course iconPurdue UniversityFull Stack Development Certificate Program
  • 9 Months
course iconIIIT BangaloreExecutive Post Graduate Program in Software Development - Specialisation in FSD
  • 13 Months
Angular TrainingBasics of Spring Core and MVCFront-End Development BootcampReact JS TrainingSpring Boot and Spring CloudMongoDB Developer Coursecourse iconBlockchain Professional Certification
  • 40 Hours
course iconBlockchain Solutions Architect Certification
  • 32 Hours
course iconBlockchain Security Engineer Certification
  • 32 Hours
course iconBlockchain Quality Engineer Certification
  • 24 Hours
course iconBlockchain 101 Certification
  • 5+ Hours
NFT Essentials 101: A Beginner's GuideIntroduction to DeFiPython CertificationAdvanced Python CourseR Programming LanguageAdvanced R CourseJavaJava Deep DiveScalaAdvanced ScalaC# TrainingMicrosoft .Net Frameworkcourse iconSalary Hike GuaranteedSoftware Engineer Interview Prep
  • 3 Months
Data Structures and Algorithms with JavaScriptData Structures and Algorithms with Java: The Practical GuideLinux Essentials for Developers: The Complete MasterclassMaster Git and GitHubMaster Java Programming LanguageProgramming Essentials for BeginnersComplete Python Programming CourseSoftware Engineering Fundamentals and Lifecycle (SEFLC) CourseTest-Driven Development for Java ProgrammersTypeScript: Beginner to Advanced
  • Home
  • Blog
  • Devops
  • How to Restart Jenkins in Linux, Windows, Mac? [4 Methods]

How to Restart Jenkins in Linux, Windows, Mac? [4 Methods]

By Mayank Modi

Updated on Oct 21, 2022 | 10 min read | 24.1k views

Share:

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 to 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.

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 one is to restart safely, and another way is to force restart. 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.  

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.  

  1. Follow the steps below to understand the process completely.  
  2. First login to Jenkins 
  3. Then, select the 'Manage Jenkins' option from the left-hand side menu.  
  4. Now, scroll down and click on the 'Prepare for Shutdown' tab under 'Tools and Shutdown.' 

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 yes, then you can restart Jenkins manually directly from the URL. 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 below command to restart Jenkins from the URL safely:

[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. 

  1. Log in to Jenkins, and from the left menu bar on the dashboard, click on Manage Jenkins. 
  2. Now, go to the System Configuration and select Manage Plugins. 
  3. Then, as the Plugin Manager window opens, click on the Available tab. 
  4. Now, on the search bar, type 'Safe restart.' From the search result, tick the box beside the plugin name. 
  5. Then add the plugin by clicking on the Install without restart button. 
  6. After installing the plugin, go back to the dashboard and click on the Restart Safely tab on the left. 
  7. 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, 

  1. In the first step, download the .jar file of the Jenkins CLI. 
  2. Now, open the Jenkins dashboard on your browser and click on the Manage Jenkins tab from the left-hand side menu bar. 
  3. Next, scroll down to the Tools and Actions section and click the Jenkins CLI button. 
  4. Download the Jenkins-cli.jar
  5. As the download completes, open the terminal window and run the below-mentioned syntax to restart Jenkins.
java -jar [path to the jenkins-cli.jar file] -s [Jenkins URL] restart

How to Restart Jenkins in Windows, Linux, and Mac?

After installing Jenkins on your system, it runs as a background process. Therefore, you can easily restart Jenkins on your Linux, Windows, and Mac computer by following the simple commands you follow while restarting other services. However, we have mentioned the steps you may follow below to get the job done. Check them out now! 

A. Restart Jenkins in Linux 

Run the following syntax on your Linux terminal to restart Jenkins:

sudo systemctl restart Jenkins

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, 

  1. On your Windows computer, open the Command Prompt with administrative rights. 
  2. Then, run the following command to restart Jenkins on Windows.
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 your Mac, you need to use the basic launchctl commands to stop and start the Jenkins services. Follow the commands here,

sudo launchctl unload /Library/LaunchDaemons/org.Jenkins-ci.plist 

Restart Jenkins Stages 

You can restart Jenkins stages once the Pipeline completes, whether it has succeeded 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:

  1. As your Pipeline completes, go to the side panel on the classic UI. 
  2. Next, locate the Restart from Stage button and click on it. 
  3. 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:

  1. Firstly, access your project's CI service page. 
  2. Then, select the Open Blue Ocean option from the left menu to find your project's Pipeline. 
  3. Now, select the Pipeline and click on the build you want to restart. 
  4. Then, you have to select the stage from which you want to restart. 
  5. 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.  

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 for restarting 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?

2. How do you rerun a pipeline in Azure DevOps?

3. How do I keep the Jenkins pipeline after a host reboot?

Mayank Modi

Mayank Modi

86 articles published

Get Free Consultation

By submitting, I accept the T&C and
Privacy Policy