Infrastructure at your Service

Nabil Saoual

JENKINS – some ways to restart manually Jenkins services

By July 30, 2021 DevOps No Comments

Hi Team,

Depending on your actions performed on your master,sometimes Jenkins needs to be restarted,for that,we have many alternatives,it is not supposed to be a tough task but it can be helpful to know how to do that…..So let’s see that!

Using Jenkins WEB URL interface

By connecting to your Jenkins dashboard you have the choice to restart the Jenkins master directly or wait for builds running to be completed before that.

Restart Jenkins

Force a Jenkins restart even if builds are running
command:
Jenkins URL + restart
http://localhost:8080/restart

Restart Jenkins safely

Jenkins will be restarted after builds running are completed
command:
Jenkins URL + restart
http://localhost:8080/saferestart

Use saferestart plugin

Go to plugin manager and look for saferestart plugin


A new option will be displayed on your dashboard:

Using Services

  • On Linux

command
[[email protected] ~]# sudo service jenkins restart
Restarting jenkins (via systemctl): [ OK ]

  • On Windows

Go the Jenkins installation path and use below command

command
jenkins.exe restart

Using windows services

Type services.msc on your search bar ( or select execute -> services.msc )

Using Jenkins CLI

Using Jenkins dashboard you can see all the Jenkins CLI options

You can also display the Jenkins help on your CMD by using the below syntax:

You can use the restart or safe restart syntax as below:

Example:

Note:
Regarding my configuration I am working on Centos and Windows 10 so you can have additional info to restart your services with different OS following this helpful topic thanks to all people sharing their knowledge and experience:)
https://stackoverflow.com/questions/8072700/how-to-restart-jenkins-manually?page=2&tab=active#tab-top
there are some case as restarting on Mac , on FreeBSD and docker.

Conclusion:

Now you know how to manage your Jenkins master services,see how Jenkins CLI can be helpful and how it is simple to use Jenkins GUI to perform a safe restart 🙂
Stay tuned for more Jenkins and Control-M tips 🙂

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Nabil Saoual
Nabil Saoual

Consultant