Fwd: Disconnect node / reconnect node programmatically (Groovy)

1,371 views
Skip to first unread message

pjl8...@gmail.com

unread,
Oct 17, 2014, 4:30:02 PM10/17/14
to jenkins...@googlegroups.com


On Friday, October 17, 2014 11:09:04 AM UTC-7, pjl8...@gmail.com wrote:
Hi 

I need to disconnect and reconnect  nodes programmatically ( in groovy if possible) is there a way to do this?

Thanks
Peter

pjl8...@gmail.com

unread,
Oct 17, 2014, 4:33:16 PM10/17/14
to jenkins...@googlegroups.com

felix

unread,
Oct 20, 2014, 3:40:16 PM10/20/14
to jenkins...@googlegroups.com
something like

import jenkins.model.*;
for (slave in Jenkins.instance.slaves) {
  def comp=slave.computer;
  if (comp.isOffline()) {
    if (comp.getOfflineCauseReason().matches(".*computer was idle.*")) {
      comp.connect(true);
    } else {
      println("${comp.name} went offline unexpected");
--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

pjl8...@gmail.com

unread,
Oct 20, 2014, 7:18:17 PM10/20/14
to jenkins...@googlegroups.com

Just to be clear, the solution you proposed for connecting is not just for  handling the temporary offline case?
Do you also have a solution for disconnecting a slave, not just temporarily taking it offline (I want to close the channel of communication between master and slave)?

In the reconnect case I want to open the channel between slave and master.

Thanks
Peter

felix schwitzer

unread,
Nov 2, 2014, 8:57:01 AM11/2/14
to jenkins...@googlegroups.com
My code snippet was just a starting point. To elaborate your use case you may need to
do some investigations; a good start point may be
http://javadoc.jenkins-ci.org/

sridevi...@gmail.com

unread,
Dec 19, 2017, 2:10:05 PM12/19/17
to Jenkins Users
Hi,
               I want to have a script (bash) which can disconnect & reconnect a Jenkins slave connected through JNLP.
               Please do the needful.

              Thanks & Regards,

              Sridevi  
Reply all
Reply to author
Forward
0 new messages