Posted on 12-11-2018 01:20 AM
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?
Posted on 12-11-2018 07:33 AM
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