Last active
September 12, 2021 07:44
-
-
Save turboBasic/7e89b897ad86cd45ac3e7edb23ea4eff to your computer and use it in GitHub Desktop.
Execute complex bash command in Jenkins script console #jenkins #groovy #shell
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
String DIR = '/data/jenkins/workspace/UISW-C-UI/Daily/c-daily-build' | |
void executeInBash(String bashCommand) { | |
java.lang.Process process = ['/bin/bash', '-c', bashCommand].execute() | |
process.waitFor() | |
println process.getText() | |
} | |
////// | |
[ | |
"ls -AlF $DIR", | |
"sudo ps auxww | grep -P 'jenkins|ssh' && free", | |
] | |
.each { | |
executeInBash it | |
} | |
null |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment