Hey! I thought I'd try my luck here as well. Im trying to use checkJSSconnection in a while loop but the computer just get stuck in the loop. This happens after setup assistant is complete and the account is logged in.
Code:
jamf checkJSSConnection -retry 0 >> null
status=$?
until [[ $status == 0 ]]; do
jamf checkJSSConnection -retry 0 >> null
status=$?
echo "$(timestamp) Unable to connect to Jamf, retrying ..." | tee -a $log
/bin/sleep 2
done
The exit code returned is 1, and never stops being 1 so the loop continues forver.
The thing is, I do have connection to jamf. If I start a new terminal window and run checkJSSconnection it will return 0. If I kill the jamf process and rerun the script via manual trigger, checkJSSconnection will return 0 on the first try.
This happens every time I run a new test enrollment via prestage, so its not a one time thing.
If I disconnect my wifi, start the loop and then reconnect the wifi the loops exits as soon as the connection is established, so the code seems to work fine. And also if I run this in the terminal, it returns Status is: 0
jamf checkJSSconnection -retry 0 >> null; status=$?;echo "Status is: $status"
So im not really sure how to proceed. Ideas? I know theres other ways I can check the connection, but now Im too stubborn to let this one go :P