Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Click here to return to the '10.5: Schedule OS X software updates via script' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
10.5: Schedule OS X software updates via script
Authored by: atonaldenim on Jun 25, '09 12:55:58PM

The premise of this article is correct. Scheduling Software Updates via launchd is the ideal method in Leopard. It will run as root, without any user intervention, regardless of whether any user is logged in, at a reliable interval that is easily controlled.

In our small office, our DSL line gets choked up whenever any of the computers decides to automatically start downloading updates. We've made sure to uncheck "Download important updates automatically" in the SU preferences on all machines. (Unfortunately this preference seems to be sometimes forgotten after OS X updates.)

We've had success so far just invoking the softwareupdate command directly from the plist file, rather than creating a separate shell script. Here is our example script to install all available updates every day at 3 am, to be placed in /Library/LaunchDaemons (so it will run as root):

<?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
 <plist version="1.0">

The trick is making sure that the computer is turned on at the scheduled time - I don't believe launchd is capable on its own of starting up the computer to run a scheduled task. You can use System Preferences > Energy Saver > Schedule... to make the computer wake or start up just before the Software Update script is set to run, in this case say 2:55 am.

The original poster indicated that the computer may not be able to automatically restart itself this way, but you could use the Energy Saver scheduler to force a shutdown at a reasonable interval afterward, say 4:00am in this example, depending on the speed of the internet connection.

I only wish Apple would provide an interface to schedule Software Updates, as Microsoft has done for ages! In a network of several Macs and only a modest DSL connection, setting Software Update to download only in off-hours is critical.

(Note: the free program Lingon is very handy for creating launchd plists in the right place with the right permissions. Highly recommended.)

[ Reply to This | # ]