How to Restart Jenkins?

Learn via video courses
Topics Covered

Overview

Jenkins is a widely-used automation server for streamlined CI/CD processes in software development. In this guide, we'll explore how to restart Jenkins effectively to apply changes and optimize performance. We'll cover various methods, including URL, Safe Restart Plugin, and CLI. By the end, you'll have the know-how to ensure a smooth development workflow.

Transform Your Career

Choose from our industry-leading programs designed for career success

NSDC Certified

Modern Software and AI Engineering Program

Master full-stack development with AI integration

12 MonthsDuration
AI-LedCurriculum
Career SupportSupport
GoogleAmazonPaytm+1000 more
Go to Program
NSDC Certified

Modern Data Science and ML with specialisation in AI

Advanced data science techniques with AI specialization

12 MonthsDuration
AI-LedCurriculum
Career SupportSupport
GoogleAmazonPaytm+1000 more
Go to Program
NSDC Certified

Advanced AIML with Specialisation in Agentic AI

Deep dive into AIML with focus on Agentic systems

12 MonthsDuration
AI-LedCurriculum
Career SupportSupport
GoogleAmazonPaytm+1000 more
Go to Program
NSDC Certified

DevOps, Cloud & AI Platform Engineering

Build and manage AI-powered cloud infrastructure

12 MonthsDuration
AI-LedCurriculum
Career SupportSupport
GoogleAmazonPaytm+1000 more
Go to Program
NSDC Certified

AI Engineering Advanced Certification by IIT-Roorkee

Premier AI engineering certification from IIT-Roorkee

3 MonthsDuration
AI-LedCurriculum
Career SupportSupport
Program highlights
Go to Program

Methods to Restart Jenkins

In this section, we will explore different methods to effectively restart Jenkins and ensure its smooth operation. Each approach caters to specific scenarios, providing flexibility to users based on their preferences and system requirements. Let's delve into the various ways we will cover:

how-to-restart-jenkins1

  1. Restart Jenkins via URL
  2. Restart Jenkins via Safe Restart Plugin
  3. Restart Jenkins via CLI
  4. How to Restart Jenkins in Windows

By covering these various restart methods, you will be equipped with the necessary knowledge to handle different restart scenarios effectively. Let's proceed to explore each method individually in the subsequent sections.

Restart Jenkins Via URL

If you access the Jenkins dashboard through a web browser, restarting Jenkins can be achieved manually using specific URLs. To force restart Jenkins instantly, use the following command in the URL, which will halt ongoing builds and initiate an immediate restart:

[Jenkins_URL]/restart

However, if you prefer a safe restart, allowing ongoing builds to complete before the restart, the command differs slightly:

[Jenkins_URL]/safeRestart

Upon executing either command, you will be redirected to the dashboard, where a confirmation notification will appear. Simply click "Yes" to proceed with the restart.

To find the Jenkins URL, locate the port on which Jenkins runs on your system; the default port is usually '8080'. The Jenkins URL will display the hostname and port number.

When accessing Jenkins from your system, use the following commands in the URL bar:

http://localhost:8080/restart

http://localhost:8080/safeRestart

However, if you are accessing Jenkins from another system, modify the commands accordingly:

http://[system_hostname]:8080/restart

http://[system_hostname]:8080/safeRestart

By following these instructions, you can effortlessly restart Jenkins and manage ongoing builds to ensure a smooth development workflow.

Restart Jenkins Via Safe Restart Plugin

As mentioned earlier, you have the option to safely restart Jenkins using the convenient Safe Restart Plugin. If the plugin is already installed, you can easily initiate a restart directly from the dashboard's left menu bar.

However, if you haven't installed the Safe Restart Plugin yet, follow these step-by-step instructions to add it to your Jenkins environment:

  1. Log in to your Jenkins account and navigate to the dashboard.
  2. Click on "Manage Jenkins" from the left menu bar.
  3. In the "System Configuration" section, select "Manage Plugins."

how-to-restart-jenkins2

  1. The Plugin Manager window will appear, displaying various tabs. Click on the "Available" tab.
  2. In the search bar, type 'Safe restart' to find the plugin quickly. Once it appears in the search results, check the box next to the plugin's name.
  3. Proceed with installing the plugin by clicking the "Install without restart" button.

how-to-restart-jenkins3

  1. After the installation is complete, return to the dashboard.
  2. From the left menu bar, click on the "Restart Safely" tab.

how-to-restart-jenkins4

  1. A notification will prompt, asking for your confirmation to restart Jenkins safely. To proceed, click the "Yes" button.

how-to-restart-jenkins4

By following these straightforward steps, you will have successfully installed and utilized the Safe Restart Plugin in Jenkins. This enables you to perform safe restarts with ease, ensuring the completion of ongoing builds and minimizing potential disruptions to your development process.

Restart Jenkins via CLI

Jenkins's Command Line Interface (CLI) is an extension to the user's native terminal shell, built on Java, and enables users to manage Jenkins using Java commands. Restarting Jenkins from the CLI is one of the actions you can perform using this powerful tool.

If you wish to use the Jenkins CLI to restart its functions, follow these step-by-step instructions:

  1. Start by downloading the Jenkins CLI .jar file.
  2. Access the Jenkins dashboard in your web browser and click on the "Manage Jenkins" tab from the left-hand side menu bar.
  3. Scroll down to the "Tools and Actions" section and click the "Jenkins CLI" button.
  4. Download the Jenkins-cli.jar file.
  5. Once the download is complete, open a terminal window on your system.
  6. Execute the following command to restart Jenkins using the Jenkins CLI: java -jar [./path/to/jenkins-cli.jar file] -s [jenkins_URL] restart

By following these steps, you can effectively restart Jenkins using the Command Line Interface. This approach provides advanced users and automation enthusiasts with a powerful means to manage Jenkins functionalities seamlessly.

Free Courses by top Scaler instructors
Python Course for Beginners With Certification: Mastering the Essentials
Java Course - Mastering the Fundamentals
DBMS Course - Master the Fundamentals and Advanced Concepts
JavaScript Course With Certification: Unlocking the Power of JavaScript
C++ Course: Learn the Essentials
Python and SQL for Data Science Course
Python Course for Beginners With Certification: Mastering the Essentials
Java Course - Mastering the Fundamentals
DBMS Course - Master the Fundamentals and Advanced Concepts
JavaScript Course With Certification: Unlocking the Power of JavaScript
C++ Course: Learn the Essentials
Python and SQL for Data Science Course

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

After successfully installing Jenkins on your system, it runs as a background process, making it easy to restart on Linux, Windows, and Mac computers using standard commands. Below are the steps you can follow for each operating system:

Scaler Placement Report and Statistics

₹23L
AVG CTC
SCALER PLACEMENT PROOF

Scaler learners achieved 2.5x salary growth with average post-Scaler CTC reaching ₹23L.

11,000+placements
650+companies
Verified data
Hiring Partners:
GoogleGoogleAmazonAmazonMicrosoftMicrosoftFlipkartFlipkartAdobeAdobe1200+ more

Restart Jenkins in Linux:

To restart Jenkins on Linux, execute the following command in your terminal:

sudo systemctl restart jenkins

Restart Jenkins in Windows:

On Windows, you have two methods to restart Jenkins:

Open the Command Prompt with administrative rights and use the following commands:

Alternatively, you can navigate to the Jenkins installation folder and restart the .exe program with these commands:

Restart Jenkins in macOS:

For macOS, utilize the basic launchctl commands to stop and start the Jenkins services:

By following these simple instructions, you can easily restart Jenkins on your respective operating system.

Turn Learning into Career Growth

1200+Hiring Partners
89%Placement Rate
11,000+Placements
147%Avg Salary Increment
2.5XCareer Growth
₹23 LPAAvg Post-Scaler Salary
1200+Hiring Partners
89%Placement Rate
11,000+Placements
147%Avg Salary Increment
2.5XCareer Growth
₹23 LPAAvg Post-Scaler Salary

Conclusion

  • Restarting Jenkins is a crucial practice for applying configuration changes, resolving issues, and optimizing system performance in software development projects.
  • The availability of multiple restart methods, including URL, Safe Restart Plugin, and CLI, provides flexibility and convenience to Jenkins users based on their preferences and requirements.
  • Utilizing the Safe Restart Plugin ensures ongoing builds are allowed to complete, minimizing disruptions and ensuring a smooth development workflow.
  • Jenkins CLI offers advanced users an efficient way to manage Jenkins functions, including restarting the server, through Java commands.
  • Regardless of the operating system, restarting Jenkins is achieved through straightforward commands on Linux, Windows, and macOS, streamlining the process for all users.
  • By mastering the techniques to restart Jenkins, users can maintain an optimized CI/CD workflow, enhancing the efficiency and reliability of software delivery.