Let Jenkins Hit Itself in the Head without Fear (a.k.a. Restart Safely)

Written by: Stephen Connolly



While recent improvements in Jenkins  have removed some of the need for restarting, there will always be times when you need to restart. If your Jenkins instance is busy, running lots of jobs on multiple nodes, finding a window in time when you can restart safely because there are no running jobs can be next to near impossible. You could use the “Prepare for Shutdown” management option to stop new jobs from being scheduled, but then you have to remember to actually restart the Jenkins instance... and if a 36h build job is 15h in, chances are you will forget to login in 17h to restart the instance so that new builds can start again and Jenkins can keep your codebase’s back safe from developers breaking tests.

Enter the Safe Restart Plugin, which will wait those 17h for you and then restart Jenkins on your behalf.

Stable Release Versions

The latest release is 0.2 which was released in September 2011 and has no known issues.

Requirements for Plugin-Use

Jenkins 1.421 or newer.

Step-by-Step Instructions on How to Use the Safe Restart Plugin


Safe Restart Plugin Installation

  1. Go to your Jenkins instances root page.
  2. If your Jenkins instance has security enabled, login as a user who has the Overall | Administer permission.
  3. Select the Manage Jenkins link on the left-hand side of the screen.
  4. Select the Manage Plugins link.
  5. On the Available tab, select the SafeRestart Plugin and click the Download and Install button at the bottom of the page.
  6. (If you are using a version of Jenkins prior to 1.442) Restart Jenkins once the plugins are downloaded.

Nothing to configure.


  1. Click on the Restart Safely button.
    Safe Restart Plugin configuration
  2. Click on Yes.
    Safe Restart Plugin configuration
  3. Go make a cup of coffee.

Tips & Tricks

  • Note this plugin just puts a link on the main page, Jenkins' core functionality provides the safe-restart functionality, i.e. you can still use the http://jenkins-url /safeRestart link to restart safely without installing this plugin.

Known Issues

  • If your Jenkins instance's servlet container does not support a web application restarting its own context, then this plugin cannot provide restart functionality, and the “Restart Safely” link will not appear.

Relevant Documentation

- Stephen Connolly, Elite Developer and Architect


Stay up to date

We'll never share your email address and you can opt out at any time, we promise.