05401, 05403, 05446, 05462, 05482, 05673, 05701, 37signals, 40hz, 2008, 2010, aardman animations, ac propulsion, adium, ads, aim, airport, al franken, algorithm, amazon, andy hertzfeld, animation, apache, apple, applescript, architecture, archive, art, article id, asterisk, at&t, atom, automobile, away message, backpack, badge, barack obama, basecamp, bash, beos, bernie sanders, bicycling, bill atkinson, billboard, blacklisting, blog, blogroll, blogzot, bluetooth, blunt, bluray, book, bookmarklet, bot-net, brad bird, browser, btv, bug, build, bungie, bunny, burlington, call of duty, camera, camping, can-spam, cars, centralized, channel camp, chocolate, classic, classic mac workshop, clothing, cms, collection, color classic, comedy, comedy central, comic, computer, concert, conversion, cookbook, corrosion, cowards way out, crack, crashing, creature comforts, criticism, daring fireball, darwin, dashboard, david byrne, dcl, death, delicious, derbi, design, development, digg, dilemma, discussion, disney, domain, download, drivers, dvd, dynetk, e-mail, e3, easter, ebox, eckhart, eckhart köppen, eckhart koppen, eddie izzard, edward gorey, einstein, election, electric motorcycle, electric motorsport, electric vehicle, electronics research laboratory, elmo, emate, emulator, encryption, environment, environmental impact, erin mckeown, escale, exploit, express 530t, expressionengine, feature, feed, feedburner, filtering, finance, firmware, fixdavsvn, flickr, flynn center, focus, font, food, ford, for sale, free, freeverse, freezing, fresh air, frog design, front row, fusion, games, gears of war, geek, geek technique, geocities, gmail, google, gpr, grammar, grant hutchinson, graylisting, gtd, hack, haiku, halo, hayao miyazaki, health, higher ground, highrise, hiking, hiroshi noguchi, history, hope, hotspot, html, html5, hulu, humor, hybrid, hybrid technologies, hypercard, intel, internet, interview, ipad, iphone, ipod touch, isao takahata, itunes, jabber, japan, javascript, jetblue, jfk, john gruber, john oliver, jon stewart, kid koala, launchd, layover, leopard, liberal, long trail, lorem ipsum, mac, macbook pro, macpaint, macworld, maczot, magazine, mail, maine, makkintosshu, marathon, marketing, mark hoekstra, matthias melcher, media, mesagepad, messagepad, microbus, microsoft, mobileme, model s, modern warfare, money, monitoring, moon river, motorola, movie, movies, mrtg, multitasking, music, mwsf07, mystic, nascar, ncx, nda, netflix, network, newton, newton os, newton press, newtontalk, newton x press, nick park, nitch, npr, on point, openpbx, open source, operation ivy, optimization, organic, os 6, os 8, os9, osheaga, osx, os x, owc, package, palm, password, patch, paul guyot, pbx, pdf, pesticides, photography, pico card, pilot, pixar, playstation, plist, plug-in, pod jungle, politics, productivity, ps3, psp, pump-and-dump, quickdraw, quicksilver, racism, rack-n-roll, radio, ratatouille, rebooting, recycling, remake, required reading, restoration, retrochallenge, review, roadster, room without a window, rss, scion, screencast, script, search, security, server, sesame street, seven days, shame, shelburne, shelburne museum, shirt, shoppinging cart, signature, simon bell, small dog electronics, snow leopard, social, software, solution, sony, spam, spam haus, startup item, statistics, status, stefano paris, stephen colbert, steve jobs, steven colbert, steven frank, studio 360, studio ghibli, subethaedit, subversion, susan kare, swiss, sync, syndication, sysmon, tablet, tags, tax, technorati, ted talk, television, terry gross, tesla motors, textpattern, the colbert report, the daily show, the flaming lips, the gashleycrumb tinies, the radiator, the world, times argus, titles, tkip, todd kollins, tom gage, trailer, travel, tree, trends, troubleshooting, truetype, twitter, typography, tzero, unicel, unna, update, upgrade, url title, user interface, v710, venue, verizon wireless, vermont, victor rehorst, video, virtualization, vmware, volkswagen, volvo 122, vpr, vw, wait wait don't tell me, wall-e, wallace & gromit, wavelan, web, web 2.0, webkit, web site, whitepaper, wifi, wikipedia, windows, winter warm-up, wireless, wpa, writing, wwdc, wwnc, xbox 360, xbox live, xhtml, yahoo, ze frank, zero emission
Articles Tagged "launchd":
Automating fixDAVsvn ¬
2009-11-17
I published my fixDAVsvn script seven months (and one day) ago to automate the process of fixing apache configuration files that have been manually modified to serve up Subversion repositories (per Nayan Hajratwala’s instructions) when they’re overwritten by Server Admin. This has made managing my apache install considerably easier, but upon rolling it out on a colleague’s server this afternoon I realized it was only ever a half solution. Sure, I had saved myself considerable time just by running fixDAVsvn, but others aren’t necessarily going to want to and there’s really no need. Time to add the second half.
So, how does one automate the process of running a command on a particular file whenever it’s modified? With launchd, of course! launchd drives some admins nuts, but I find it to be quite a boon and this happens to be exactly one of the cases it was designed for. So, I whipped up /Library/LaunchDaemons/com.makkintosshu.fixDAVsvn.plist:
<?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>com.makkintosshu.fixDAVsvn</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/bin/fixDAVsvn</string>
<string>/etc/apache2/sites/0001_any_80_svn.domain.tld.conf</string>
</array>
<key>WatchPaths</key>
<array>
<string>/etc/apache2/sites/0001_any_80_svn.domain.tld.conf</string>
</array>
</dict>
</plist>
The full path to the config file to run fixDAVsvn on needs to exist in both the ProgramArguments & WatchPaths arrays in com.makkintosshu.fixDAVsvn.plist. That said, you can add as many config files to watch and fix as you like.
So, the complete solution1 is to install fixDAVsvn and com.makkintosshu.fixDAVsvn.plist, then edit the latter to watch & fix your modified apache configuration files. I’ll likely package this all up with a script to build com.makkintosshu.fixDAVsvn.plist’s list of files automatically, but it may be another seven months.
1 This solution has been tested on both Mac OS X 10.5 (Leopard) Server and Mac OS X 10.6 (Snow Leopard) Server.
Automatic Delicious Backups Under Leopard ¬
2009-01-26
I’ve been using delicious.com, nee del.icio.us, for my bookmarks on and off since early 2006, but only recently have I decided to really keep all my bookmarks there. Yahoo!‘s future has been somewhat questionable as of late and I’m not entirely sure I like the idea of not having my data backed up in a place where I can get at if the service goes down. I don’t really have control over the former, but the latter I do.
Delicious has a tool to export your bookmarks that gives you an HTML bookmark file for easy importing into a browser, but, alas, it’s not really scriptable. However, they do offer a way to dump all your bookmarks to xml using their API.
So, I whipped up the following bash script to perform the backup and tossed it in ~/bin/deliciousBackup:
#!/bin/bash# # deliciousBackup - delicious.com bookmarks backup # # See: http://delicious.com/help/api#posts_all # # v0.1 2009-01-25 - Morgan Aldridge <morgant@makkintosshu.com> # Initial version. #user='<username>' pass='<password>' date=`date "+%Y-%m-%d"` src='https://api.del.icio.us/v1/posts/all' dst='Users/<username>/Documents/Backups'curl -s --user $user:$pass $src | bzip2 > $dst/delicious.com-$user-$date.xml.bz2
I needed to make deliciousBackup executable, but also wanted to make sure it wasn’t readable by any other user/group since it contains my password in plain text:
chmod 700 ~/bin/deliciousBackup
Of course, if someone ever had direct access to my hard drive they could still pull my Delicious password from that file, so consider yourself warned.
I prefer to run most of my backup scripts and such using launchd instead of cron since it follows my home folder sync better, so I tossed the following .plist in ~/Library/LaunchAgents/com.makkintosshu.deliciousBackup-morgant.plist:
<?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><tld>.<domain>.delciousBackup-<user></string>
<key>ProgramArguments</key>
<array>
<string>/Users/<user>/bin/deliciousBackup</string>
</array>
<key>StartCalendarInterval</key>
<dict>
<key>Hour</key>
<integer>12</integer>
<key>Minute</key>
<integer>0</integer>
</dict>
</dict>
</plist>
The following call loaded my LaunchAgent without a logout:
launchctl load ~/Library/LaunchAgents/com.makkintosshu.deliciousBackup-morgant.plist
You’ll note that the LaunchAgent runs every day at noon. That’s because I currently run this on my MacBook Air which may not be online most nights, but is usually online by mid-day.
Feel free to use this method if you’re so inclined.
Sysmon Startup Item with Leopard Launchd Support ¬
2008-08-20
I’ve been sitting on, and tweaking infrequently, a launchd plist for Mac OS X 10.5 Leopard (and Server, of course) for launching the Sysmon daemon at boot and keeping it running. Well, it’s time to release it out into the wild, so without further ado:
This is an update to my Sysmon StartupItem in that I’ve rewritten the install script to install either the StartupItem or the launchd plist file where appropriate (utilizing the little trick I wrote about a few days ago), plus updates to the documentation and such. It should support Panther & Tiger via the StartupItem and Leopard via the launchd plist. Of course, more details and previous versions can be found on the Development page.
Let me know how it goes if you use it.

