Scheduling MacPorts updates
October 5th, 2007
I like to stay pretty current with ports - generally it avoids Big Update Day where you realise you need a 0.0.0.0.0.1 update of something but most of the dependencies have seen several man-years of development in the mean time. Here is a launchd script to drop in /Library/LaunchDaemons (I called it org.macports.port-selfupdate.plist):
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>Label</key> <string>org.macports.port-selfupdate</string> <key>LowPriorityIO</key> <true/> <key>Nice</key> <integer>1</integer> <key>ProgramArguments</key> <array> <string>/opt/local/bin/port</string> <string>selfupdate</string> </array> <key>ServiceDescription</key> <string>Update MacPorts binary and ports tree</string> <key>StartCalendarInterval</key> <dict> <key>Hour</key> <integer>21</integer> <key>Minute</key> <integer>00</integer> </dict> </dict> </plist> |
You can load it without rebooting by running:
$ sudo launchctl load \
/Library/LaunchDaemons/org.macports.port-selfupdate.plist
I guess it could be done with periodic, but I wanted to play around with launchd. You may wish to adjust the time too - this is for my home machine. I am usually working at 9pm, when most normal people are watching telly.

Leave a Reply