I am having an issue with a policy that launches the script below. I grabbed bits and pieces from some other great script ideas out here! The issue is that when enacted and the computer restarts the policy is still shows as enabled and not completed. I have moved around the shutdown -r +5 command but still no love. Any thoughts? Thanks.
!/bin/bash
delayWhileScreensaver (){
pidSaver=0
while [[ $pidSaver != "" ]]; do
sleep 5
echo "Looping, pidSaver=" "$pidSaver"
pidSaver=$(ps -ef | "grep [S]creenSaverEngine" | awk '{print $2}')
done
}
delayWhileScreensaver
shutdown -r +5
level=$(/Library/"Application Support"/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper -windowType hud -timeout 300 -title "XXXX MAC" -heading "Critical Alert!" -lockHUD -countdown -button1 "OK" -button2 "Restart now" -description "blah blah blah." -icon /Library/"Application Support"/JAMF/bin/icon.png &)
if [ "$level" == "2" ]; then
killall jamfHelper
shutdown -r now
fi
shutdown -r +5
if [ "$level" == "1" ]; then
killall jamfHelper
fi
exit 0
