#!/bin/bash ##################################################################################### # Shellscript : User kann entscheiden, wann das Gerät neugestartet wird. # Autor : Andreas Vogel, macenterprise gmbh, 12.112.2019 ##################################################################################### #################################### Jamf Helper #################################### jamfHelper="/Library/Application Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper" jamf="/usr/local/bin/jamf" user=$(stat -f '%u %Su' /dev/console | cut -d ' ' -f 2) INGIcon="/Users/$user/Library/Application Support/com.jamfsoftware.selfservice.mac/Documents/Images/brandingimage.png" Message="Auf diesem Gerät wurde ein Sicherheitsupdate aufgespielt. Dieser erfordert einen Neurtart des Gerätes. Bitte startet das Gerät neu oder wähle eine andere Zeit aus, wann das Gerät neugestartet wird. A security update has been applied to this device. This requires a Neurtart of the device. Please restart the device or select a different time when the device will restart. " RestartOptions=$("$jamfHelper" -windowType utility -icon "$INGIcon" -title "Please restart" -description "$Message" -button2 "Restart in" -showDelayOptions "300, 900, 1800" -button1 "Immediately" -cancelButton 1 -defaultButton 2 -timeout "300" -countdown -alignCountdown "right") #################################### Variablen #################################### # Zur weiterverarbeitung buttonClicked="${RestartOptions:$i-1}" timeChosen="${RestartOptions%?}" timeMinutes=$((timeChosen/60)) timetosleep=$((timeChosen-60)) ErrorIcon="/Library/Application Support/JAMF/ING/France_road_sign_A14.svg.png" MessageAgain="Das System wird in 1 Minute neugestartet. Es erfolgt keine weiterer Hinweis. The system will restart in 1 minute. There is no further notice." #################################### Ausführung #################################### if [[ "$buttonClicked" == "2" ]] && [[ ! -z "$timeChosen" ]] then #sleep $timetosleep "$jamfHelper" -windowType utility -icon "$ErrorIcon" -title "Warning" -description "$MessageAgain" -button1 "OK" -defaultButton 1 -timeout 60 -countdown -countdownPrompt "Restart in " -alignCountdown "right" #shutdown -r +{$timeMinutes} elif [ "$buttonClicked" == "1" ] then echo "sofort neustarten" #shutdown -r now fi