Sometimes, We need to restart Jenkins Manually. This tutorial explains about How to Restart Jenkins Manually.

Jenkins Restart Manually

Jenkins is a web application that runs as a Java process in Tomcat Container. What happens to Jenkins with the Restart process? First, It shut down the Jenkins process, does stop the current job executions Next, It shows the RED colored banner on the UI, notifying all users who are logged in to the UI Then, once job execution is completed, It restarts the Jenkins server.

Multiple ways Jenkins can be restarted by the user manually.

For Linux or Unix users:-

if Jenkins is installed through apt-get or dpkg package managers, the following are commands

sudo /etc/init.d/jenkins restart
Shutting down Jenkins               [  OK  ]

Starting Jenkins                    [  OK  ]

For CentOS users,

sudo systemctl restart jenkins

Jenkins installed with deb and RPM managers on Ubuntu Debian or Redhat Linux

sudo service jenkins restart

Another way generally to kill any process

Since Jenkin is a process, find process id using ps -aef | grep jenkins, and kill it using the kill command

ps -aef | grep jenkins
sudo kill -kill pid

Next, Start the services with start instead of the restart option in the command line

For example

sudo services jenkins start

For freeBSD OS users

/usr/local/etc/rc.d/jenkins restart

For Windows:-

Installed Jenkins with Local Non -service users

Go to the Command line, go to Jenkins home directory, and run the below command

jenkins.exe restart

If you got a permission denied error, Open Powershell as Run as Administrator, run the below command

c:\jenkins\bin\jenkins.exe restart

For Command with java command using the Jenkin-cli command started Jenkins for the jar file

java -jar jenkins-cli.jar -s http://localhost:8080/ restart

if you install it as a Service in Windows,

  • Go to Windows + Run command, Type services.msc
  • Service Window opened as shown below
  • Select Jenkins Services and Right Click on it
  • Select the Restart Option on the Context Menu

Jenkins services in windows

Also You can use below command

Powershell users, run get-process command


  258      15    20616      22692             14656   0 jenkins

Next, Get-Service command to know the status

PS C:\Users\Kiran> Get-Service Jenkins

Status   Name               DisplayName
------   ----               -----------
Running  Jenkins            Jenkins

Run Restart-Service command with service name to restart server

Restart-Service Jenkins -Force (or)
Restart-Service Jenkins 

For command line users, use tasklist command

jenkins.exe                  14656 Services                   0     22,692 K

Next, you can use net stop/start to restart in command prompt

net stop jenkins
net start jenkins

get-process or tasklist command list out all process, port no and names of a Windows OS.

For Mac users:-

If you installed Jenkins with the HomeBrew tool,

brew services restart jenkins-its

Docker Container users:

if you installed Jenkin as a docker container, Find out the name of the container(Jenkins) Run the following command

docker restart jenkins

And last option provided by Jenkins provides two options irrespective of installation on any OS

  • Go to UI localhost:8080, and Select Restart Safely or run directly localhost:8080/safeRestart in the browser
    • It does the following things before restarting Jenkins
      • Existing Jobs or build-in execution will complete
      • if any job status is in the queue, It will not execute until Restart the server
      • Restart the server
      • Read to execute jobs in the queue in order of push
      • It is safest way

Jenkins safe restart

The banner looks like as given below

Jenkins safe restart banner

  • localhost:8080/restart
    • Restart the server forcefully and existing jobs and builds executes stop its execution.

Jenkins restart forceful