Apple Updates - Reboot needed prompt

Cayde-6
Valued Contributor

Hi all,

We have a requirement to run softwareupdates -ia every 24hours BUT we want to push out a jamf helper prompt IF a reboot is needed.

How are people doing this out of interest?

1 REPLY 1

tak10
Contributor II

It's not exactly you want but this is what I use to prompt users for reboot after Adobe Creative Cloud installation. I don't know if you can easy determine if the software update requires update or no update but you can try this.

#!/bin/sh

restart_response=`/Library/Application Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper 
        -windowType utility -title "Software Update" -alignHeading center -alignDescription left 
        -description "Restart is required to apply macOS software update. Not restarting may cause performance issue." 
        -button1 Restart -button2 Cancel -defaultButton 1 -cancelButton "2"`

if [[ "$restart_response" == "0" ]];
then
  shutdown -r now
else
  /Library/Application Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper 
          -windowType utility -title "Restart Cancelled" -alignHeading center -alignDescription left 
          -description "Restart Cancelled" 
          -button1 Ok -defaultButton 1
        echo "Uninstall cancelled by user"
        exit 0
fi