Skip to content

Instantly share code, notes, and snippets.

@hfs
Created November 12, 2015 15:00
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save hfs/68b2f124d1952233ba49 to your computer and use it in GitHub Desktop.
Save hfs/68b2f124d1952233ba49 to your computer and use it in GitHub Desktop.
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();
}
}
@longk15t
Copy link

how to execute a file ? e.g a groovy file

@liyiwan
Copy link

liyiwan commented Jan 18, 2020

@long

http://your Jenkins addr /script
example:
http://127.0.0.1:8080/script

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment