Skip to content

Instantly share code, notes, and snippets.

@smashism
Created February 11, 2019 17:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save smashism/2f2df4526c9baf1ae1d559d491ca9d6e to your computer and use it in GitHub Desktop.
Save smashism/2f2df4526c9baf1ae1d559d491ca9d6e to your computer and use it in GitHub Desktop.
function to check jamf pro server (JPS) connection in a shell script. jps variable must be set.
function checkJPSConnection {
n=0
until [[ $n -ge 12 ]]; do
checkAvailablity=$(${jamfBinary} checkJSSConnection)
# Function exitStatus
if [[ $checkAvailablity == *"${jps}"* ]]; then
echo "${jps} is available, continuing..."
break
else
echo "${jps} is unavailable at this time. Suspending until next interval..."
sleep 10
n=$((n+1))
fi
done
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment