Hello,
I often leave Apple Software Updates running on clients’ computers, and then leave them to run. I need a script that will reboot when finished, so servers will be rebooted and ready to go in the morning. I typically apply updates from .pkg files that are already downloaded, so I don’t use the Apple Software Update interface. This leaves me with several Installer windows with a single default button reading either Close or Reboot.
So far I have this:
set question to display dialog “Are you sure you want to reboot?” buttons {“Yes”, “No”} default button 2
set answer to button returned of question
if answer is equal to “Yes” then
tell application “Finder”
activate
delay 3000
restart
quit
end tell
end if
if answer is equal to “No” then
display dialog “Cancelling reboot” buttons {“OK”} default button 1
end if
I can change the delay line to the number of seconds I need.
The big problem is that Finder issues a shutdown, and Installer App, which has several install boxes open saying either Close or Reboot, says “Mac OS X update requires a reboot to finish” .
So the reboot hangs here. Is there any way to do one of the following:
- force quit installer first, then issue restart
OR - click default buttons on all windows in Installer first
I could use shutdown -r in a shell script, but I had trouble doing an su to become root.
Thank you for your help!
- eric