Hi Pawel,

2012/10/16 Pawel Jasinski <pawel.jasin...@gmail.com>:
> hi,
>
>
> On Mon, Oct 15, 2012 at 5:05 PM, Marek Gimza <marekgi...@gmail.com> wrote:
>> Pawel,
>>
>>
>> As an interim solution, you could have a build step that runs either a
>> groovy script or the Jenkins-cli to "disconnect-node" and "connect-node" .
>
> I have checked with the googles and came back empty handed. API docs
> do not give me any hint.
> Could you please, drop a snippet or at least sketch it.

I am currently just experimenting with utilizing our developer
desktops during night for regression tests. Maybe this Groovy-snippet
is helpful:

import hudson.model.*
import hudson.slaves.*

for (aSlave in hudson.model.Hudson.instance.slaves) {
  if (aSlave.name == 'NameOfSlave') {
    println('Enabling NameOfSlave!');
    aSlave.getComputer().doToggleOffline("Offline during office hours");
  }
}

I run this script via cron at 0 8,18 * * 1-5.

Any improvements from other people are very welcome. F.i. I do not
like the toggle, if activating in the evening fails for any reason
maybe the next toggle in the morning will work.

HTH
Dirk

Reply via email to