Skip to content

Instantly share code, notes, and snippets.

@int128
Created October 26, 2016 10:18
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save int128/14255ff1b1ed11ce1f661a7d35954c2b to your computer and use it in GitHub Desktop.
Save int128/14255ff1b1ed11ce1f661a7d35954c2b to your computer and use it in GitHub Desktop.
How to execute a remote command on the Jenkins Script Console
import hudson.util.RemotingDiagnostics;
def node = 'node-name'
def command = 'uname -a'
println RemotingDiagnostics.executeGroovy("""
def p = '$command'.execute()
p.waitFor()
println p.in.text
""", Jenkins.instance.slaves.find { it.name == node }.channel)
@longk15t
Copy link

how to execute a script file ?

@dpotam
Copy link

dpotam commented Mar 2, 2018

E.g. script console in browser
http://<JENKINS_IP>/jenkins/script

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