AFP548

Cron and softwareupdate

I have a crontab that I set up with Cronix (http://www.versiontracker.com/dyn/moreinfo/macosx/9478), a GUI editor for cron in OS X. I am trying to get my Mac clients to automatically update from the Apple software update server with no user interaction. softwareupdate -a -i will do this from the command line. It is hard to test my crontab with the download and install flags on , becuase I will run out of updates to install eventually, I am testing my cron tab with softwareupdate -schedule on. This will change the "check for updates" check box in System Preferences->Software Update. To see it change from unchecked to checked you must quit System Preferences and reopen. As a cron task it does not work.

Troubleshooting steps taken:

I have confirmed that when I run softwareupdate --schedule on from the command line it works.

I have confirmed that the cron task I set up is getting run by replacing softwareupdate --schedule on with a script that writes a file to my desktop so I can visual confirm the cron task is working.

I have tried including softwareupdate --schedule on in a script that also includes a write of some text to a file. Then calling the script from cron. The text gets written, but the softwareupdate --schedule on does not set the flag.

Cronix even has a feature to force a script to "Run Now". And it works fine then.

I am running 10.4.1.

Nothing is written to any log I can find.

Here is my crontab
# minute hour mday month wday who command
51 14 * * * root /usr/sbin/softwareupdate -- schedule on
and I also tried
51 14 * * * root softwareupdate -- schedule on
an Apple systems engineer suggested not running it as root, but as a normal user
12 3 * * * /Users/adam/Desktop/SU_On_Script

I am out of ideas. An Apple systems engenerier who tried to help me, and I spoke with John Detroye (http://homepage.mac.com/johnd/) at a conference. They both agreed it should be possible.

I would appreciate any ideas that anyone may have. However, I am so perplexed by this problem and how simple it is to set up that I am asking someone to please give it a try.

1. Open System Preferences->Software Update and set "check for updates" to false. Quit System Preferences.
2. From the command line run softwareupdate --schedule on
3. Open System Preferences->Software Update and visually confirm that this command changes the flag to true. For me it does.
4. Set check for updates to false. Quit System Preferences.
5. Set up a cron task to run softwareupdate --schedule on, or for that matter the real money maker, with caution, softwareupdate -a -i.
6. Does it work? Shouldn't it?


Software update usage, also has a man page.
usage: softwareupdate [ ...]

-l | --list List all appropriate updates
-d | --download Download Only
-i | --install Install
Exit mobile version