How can I prevent jenkins from starting new jobs after a restart?


You want to prevent any jobs from running after Jenkins starts up. This could be necessary to troubleshoot or help recover from a performance issue, or to validate an upgrade or configuration change before releasing a controller for regular use.



Any builds that are in the pending queue when Jenkins is restarted will remain in the queue and potentially be started after Jenkins finishes loading. In addition, scheduled jobs or jobs triggered externally could also start at any time. In order to prevent Jenkins from executing any jobs, you need to put it in “quiet down” mode when it starts up. There are two ways you can do this.

  1. You can install and use the Quiet Start plugin. This will give you a UI option to restart Jenkins and have it be in “quiet down” mode when it starts up. This plugin is only available to users of CloudBees Core, CloudBees Jenkins Enterprise, and CloudBees Jenkins Platform.
  2. You can create a Groovy init script that will put Jenkins in “quiet down” mode when it starts. This solution may be required if you are suffering from a performance issue and cannot access the Jenkins UI. It is also the only solution that will work for users of Jenkins LTS or CloudBees Jenkins Distribution. Create a file named quiet-start.groovy and place it in the $JENKINS_HOME/init.groovy.d/ directory. You may have to create this directory if it does not already exist. The file should contain the following:
import jenkins.model.Jenkins

// Go into quiet mode

Regardless of the solution you use, when Jenkins starts up you will see a red banner at the top of the page which says, “Jenkins is going to shut down,” along with a similar message in the Build Queue. There will be a ‘Cancel’ button which an administrator can click to cancel “quiet down” mode and allow builds to resume.

After Jenkins has started, you may find that you want to purge all builds in the build queue. To do this, you can easily do so by following our How can I purge/clean the build queue? article.

Have more questions?


Please sign in to leave a comment.