Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Keep jenkins slave offline when user logs into Windows

Is there any way to configure Jenkins to mark Windows slave offline when a user starts using slave?

EDIT: By starts using I mean user logs on.

like image 749
Oleksiy Avatar asked Jan 31 '13 20:01

Oleksiy


People also ask

Why Jenkins node is offline?

Jenkins monitors each attached node for disk space, free temp space, free swap, clock time/sync and response time. A node is taken offline if any of these values go outside the configured threshold.


1 Answers

Since a Jenkins slave can be registered as a Windows service, one way would be to ensure that there is no currently logged on user.

One could conceive a Windows tasks, running regularely, which would check if a user is logged on, and:

  • if there is one, would stop the service.
  • if not, (re)start the same Jenkins slave agent windows service.

For checking who is logged on, see "From WindowsService how can I find currently logged in user from C#?" for one way.

like image 155
VonC Avatar answered Nov 14 '22 22:11

VonC