Created
October 26, 2016 10:18
-
-
Save int128/14255ff1b1ed11ce1f661a7d35954c2b to your computer and use it in GitHub Desktop.
How to execute a remote command on the Jenkins Script Console
This file contains hidden or 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; | |
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) |
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
how to execute a script file ?