Video Screencast Help
Search Video Help Close Back
to help
Not able to make it to Vision this year? Get a sampling in the Best of Vision on Demand group.

Mac OS X Reboot Deferral

Updated: 16 May 2011
Andrew Bosch's picture
+2 2 Votes
Login to vote

Using CMS 7.x to install software updates on the Mac works quite well.  Before installing updates there is a built-in mechanism with Task Server to notify the end user.  Once updates have installed, the Mac will automatically restart as the system is left in an unstable state.  I have been asked by users how they can insert one last dialog box to warn users that a restart is about to occur and possibly allow them to defer it just long enough to save work, etc.  Using Applescript, here is a sample script that can be incorporated into the patch workflow.  I would recommend you copy and paste the script into AppleScript Editor to make sure it compiles and runs.  Sometimes copy and paste will introduce errors.  Then, create a new Run Script task and select Applescript.  Then, copy and post the working code and Save.  Then, insert the script as part of the patching process, and viola!  you have your very own patch reboot deferral!

 

 repeat

tell application "System Events" to display dialog "A restart is required to finish installing new software.

Please select Postpone to be prompted again in 1 minute or OK to restart now." buttons {"Postpone", "OK"} default button 1 giving up after 3600 with icon 0

if button returned of result = "OK" then

return 0

else if button returned of result = "Postpone" then

try

delay 60 #re-prompt user to restart every 60 seconds

end try

end if

end repeat