foxynet's blog

Scheduled commands in mac osx leopard

by foxynet on September 12, 2008, no comments

So, the problem is that broadband usage is usually metered in Australia, and my current plan allows for 4gb usage in peak and 4gb usage in off peak.  It would be great to have a simple method of forcing “non-interactive” downloads to occur during the off peak period – from memory it’s between midnight and 8:00am.

Podcasts and iTunes related downloads

Method 1 was to kick off a number of downloads in iTunes, then quit the program.  I used Lingon to create a launchd configuration to launch iTunes everynight at midnight.  Kludgy.

File downloads from the web

Slightly better option for downloading files: enable and use the at command.  Enable it by issuing the following command line in the terminal:

sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.atrun.plist

(thanks Mac OSX Hints – Use the ‘at’ command to schedule task)

Then add the file to download:

at midnight
wget http://example.com/example.dmg
^D

Software Updates

Disable automatic software updates with the following command:

softwareupdate --schedule off

Add the following command to the cron using the following:

crontab -e

Add a line that says:

0 0 * * * /usr/sbin/softwareupdate -d -a

Still need to check if this will alert me when software updates are available.

Under leopard, and running as a non-root user, this downloads the updates into the ~/Downloads folder. (not ideal).

And I think it’s kludgy (flexible?) that I’m using 3 different methods …