hyde
hyde

Reputation: 62888

Allow running some jobs when Jenkins/Hudson is in shutdown mode

Normally, selecting "Prepare for Shutdown" under "Manage Jenkins" prevents new jobs from being started (and I guess it's identical behavior under Hudson).

Now I'd like to run some maintenance jobs while Jenkins is in this shutdown mode. I didn't find any "Allow running even when Jenkins is shutting down" (or even better, "Allow running only while shutting down."

I'm actually thinking of creating a special build step, which will put Jenkins in shutdown mode, then wait and block the build until it detects that Jenkins has gone to shutdown mode and all other jobs have finished, and then continue that build. Natural pair for this is another custom build step, which will either trigger a Jenkins restart or disable shutdown mode, to be run after maintenance step is over.

But before I start coding, is there an existing solution, a plugin or whatever?

If there's a Groovy guru reading this, I would not mind the few lines of Groovy script to do this as an answer. It'd be a good excuse to get Groovy plugin installed ;-)

Upvotes: 3

Views: 1263

Answers (1)

Jason Swager
Jason Swager

Reputation: 6501

Take a look at the Exclusive Execution Plugin. It's NOT designed to execute during any arbitrary shutdown-mode, but it IS designed so that when run, it enters shutdown-mode (to prevent other jobs from running), then runs itself, then exits shutdown mode.

Upvotes: 2

Related Questions