I've not used it, but https://wiki.jenkins-ci.org/display/JENKINS/Exclusive+Execution+Plugin matches your use case exactly.
> -----Original Message----- > From: jenkinsci-users@googlegroups.com > [mailto:jenkinsci-users@googlegroups.com] On Behalf Of Didier > Durand > Sent: 02 March 2012 16:37 > To: Jenkins Users > Subject: Having a given job running absolutely alone on my jenkins: how ? > > Hello, > > During night, I want to launch a jenkins job that makes all backups > for all the ressources (database, svn, etc....) that all other jenkins > jobs use. > > So, I have to make sure that this job is running absolutely alone. > > I already have tenths of jobs configured and I don't want to change > something in their config because of this new backup job. > > What is the best way to achieve that ? > > My current plan: > a) schedule the job at 02:00 am > b) make the job reduce the number of executors to 1 for itself only > c) query the queue and executors to wait that all other job finish > d) run the backup activities > e) restore the executors to their original number > f) finish the backup job > > Questions: > 1) what is the correct way (API) to reduce the executors > programmatically ? > 2) is there anything better than my plan ? (I studied Lock&Latch and > Throttle plugin but they don't seem appropriate for that purpose) > > Thanks a lot in advance ! > > regards > > didier -- This e-mail and any attachments may contain confidential, copyright and or privileged material, and are for the use of the intended addressee only. If you are not the intended addressee or an authorised recipient of the addressee please notify us of receipt by returning the e-mail and do not use, copy, retain, distribute or disclose the information in or attached to the e-mail. Any opinions expressed within this e-mail are those of the individual and not necessarily of Diamond Light Source Ltd. Diamond Light Source Ltd. cannot guarantee that this e-mail or any attachments are free from viruses and we cannot accept liability for any damage which you may sustain as a result of software viruses which may be transmitted in or with the message. Diamond Light Source Limited (company no. 4375679). Registered in England and Wales with its registered office at Diamond House, Harwell Science and Innovation Campus, Didcot, Oxfordshire, OX11 0DE, United Kingdom