Skip to content

Instantly share code, notes, and snippets.

@jonfuller
Created July 17, 2013 13:09
Show Gist options
  • Save jonfuller/6020424 to your computer and use it in GitHub Desktop.
Save jonfuller/6020424 to your computer and use it in GitHub Desktop.
Shell script to use in a Jenkins job for displaying whether a given Jenkins slave node is up or down. Use this as an "execute shell" build step. NB: Must be run on a machine that has bash (i.e. not Windows)
NODE_NAME="name-of-node"
ENDPOINT="http://JENKINSURL_GOES_HERE/computer/api/xml?xpath=computerSet/computer\[displayName='$NODE_NAME'\]/offline/text()"
ENDPOINT_RESULT=$(curl $ENDPOINT 2> /dev/null)
if [ $ENDPOINT_RESULT = "false" ] ; then
exit 0
fi
exit 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment