Cron isn’t reliable, since Apple uses launchd. I’m not the only person who grumbles about this. I know cron. I don’t know launchd, having never had a reason to learn it, so this took some doing. And no, I’m not using a GUI app to write this stuff for me, like LingonApp, since ti feel if I do that I won’t learn how it works.
My goal was simple: Update my local copy of an app (WordPress) when I logged into my computer. Obviously this won’t work if I have no access to the Internet, but that’s okay.
I made a file called wordpress.svn.updater.plist
and put it in ~/Library/LaunchAgents/
The content of the file is as follows:
<?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>wordpress.svn.updater</string> <key>ProgramArguments</key> <array> <string>svn</string> <string>update</string> <string>/Applications/MAMP/htdocs/</string> </array> <key>RunAtLoad</key> <true/> </dict> </plist>
So basically every time I log in, SVN updates my install of WordPress, which is in /Applications/MAMP/htdocs/
as I’m using MAMP. I tried it with ~/Sites/localhost/
which is an ln
link back to the MAMP folder, but according to Console (where I read my error messages), that didn’t work. If I hard coded the path, though, it was fine.