Want to use JAMFHelper to Prompt MacOS update with delay options

timmeedski
New Contributor

I am trying to build out a jamf helper notification that will allow me to let users select a time in the drop down and use that time to delay when update are force installed.

The bolded statement is what needs to be changed so that I can do something like:

sudo DELAY???+${timeMinutes} softwareupdate -i -a 

Not really sure what my options would be here.

Currently I'm trying to adapt a JAMFHelper script I use to force reboots:

selection=$("/Library/Application Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper" -windowType "$window" -title "$title" -heading "$heading" -alignHeading center -description "$description" -icon "$icon" -button2 "Delay Restart" -showDelayOptions "600, 1800, 3600, 7200, 14400, 28800, 43200, 86400, 172800" -button1 "Restart Now" -cancelButton 2 -defaultButton 2)

buttonClicked="${selection:$i-1}"
timeChosen="${selection%?}"

# Convert seconds to minutes for restart command
timeMinutes=$((timeChosen/60))

# Echoes for troubleshooting purposes
echo "Button clicked was: $buttonClicked"
echo "Time chosen was: $timeChosen"
echo "Time in minutes: $timeMinutes"

if [[ "$buttonClicked" == "2" ]] && [[ ! -z "$timeChosen" ]]; then
echo "Restart button was clicked. Initiating restart in $timeMinutes minutes"
shutdown -r +${timeMinutes}
elif [ "$buttonClicked" == "1" ]; then
echo "Cancel button clicked. Exiting..."
shutdown -r now

2 REPLIES 2

andrew_nicholas
Valued Contributor

daniel_behan
Contributor III