Created
November 12, 2015 15:00
-
-
Save hfs/68b2f124d1952233ba49 to your computer and use it in GitHub Desktop.
Jenkins: Run a shell command on all slaves using the Groovy console. https://stackoverflow.com/questions/26583979/run-a-remote-command-on-all-jenkins-slaves-via-masterss-script-console
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import hudson.util.RemotingDiagnostics; | |
script = 'def proc = "ls -1 /media".execute(); proc.waitFor(); println proc.in.text'; | |
for (slave in Jenkins.instance.slaves) { | |
println slave.name; | |
try { | |
println RemotingDiagnostics.executeGroovy(script, slave.getChannel()); | |
} catch (all) { | |
all.printStackTrace(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
how to execute a file ? e.g a groovy file