I don't have a server or anything, but I have 1 iMac running Snow Leopard in my office that a nontechie uses. I would like for it to automatically install any new updates when the computer is told to shut down every day. I know I can set Software Update to check for updates daily, and download them if they exist. But what about actually installing them without confirming each time. I don't want to do a cron job, because if that person is working late it wouldn't be good if it tries to shut down on them. Also that person is running with a std user account, so to install updates I have to enter my admin level account's credentials. Is there any way to do this?
Installing updates (or doing anything else, for that matter) on shutdown on Mac OS X is problematic, as the operating system gives processes just eight seconds to shut down before it kills them - not nearly enough time to do updates.
Nonetheless, there are probably ways to solve your problem. Depending on how well you and your user's working patterns match up, you could wait for them to notify you that there are updates and it's convenient for them to restart, then type your administrator password in person or over VNC/Screen Sharing.
Alternatively, if you have SSH active, you can log in and use the command-line program
Apple suggest that you should restart your computer immediately after running
softwareupdate if there is an update that requires it, but you may be able to allow the computer to restart normally at the end of the day - the restart certainly isn't forced by the update program, as it is with the GUI version. If you're willing to risk this you can then script it: create the following Launchd property list.
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>Label</key> <string>some.meaningful.name</string> <key>ProgramArguments</key> <array> <string>softwareupdate</string> <string>-i</string> <string>-a</string> </array> <key>StartCalendarInterval</key> <dict> <key>Hour</key> <integer>20</integer> <key>Minute</key> <integer>00</integer> </dict> <key>RunAtLoad</key> <false/> <key>KeepAlive</key> <false/> </dict> </plist>
Save this in
/Library/LaunchDaemons/some.meaningful.name.plist, then in a terminal do:
sudo launchctl load /Library/LaunchDaemons/some.meaningful.name.plist
This will run
softwareupdate every day at 20:00, and install all available updates.