Trouble sleeping last night. Dreams that aren’t worth posting here because all they really seem to be are chilling previews of some stuff scheduled for Friday.
So instead I jumped out of bed and decided to try and cross off one of the things on my to do list. AFP548 had a great article that introduces launchd (much better than Apple’s own kb article) so I decided this morning I’d read it and follow along. And test it out.
So far so good. Put together a single stupid shell script that echos a “test” string and the date to a log file. The tricky part is making the .plist file and then “getting it” that you need to use launchctl to add the job in. That being said, two small adjustments later and I had it going. Not too shabby.
Once again, I’d like to announce that I don’t particularly care for .plist files. Once again, I’d like to announce that their documentation behind their meta-DTDs sucks.
With this first test/learning experience out of the way, I’m a little less intimidated moving forward with getting my automated jobs into launchd and all that. The first misconception that this cleared up was that I’d have to redo all my scripts etc. to bew compatible w/ launchd. Fortunately (and this should have been the most obvious part) launchd is (as the name implies) the launcher – – the same ol’ shell scripts work as always. The other misconception that I had was that there was a single flat plist file controlling everything in launchd. Nope — if I’m not mistaken, there’s a plist for each item that launchd loads up. This makes sense except for the fact that this creates 1+n places to look for instantiating files and plists/configurations — n being the number of users in the system.
More to follow…
About Rob FrieselSoftware engineer by day, science fiction writer by night. Author of The PhantomJS Cookbook and a short story in Please Do Not Remove. View all posts by Rob Friesel →
One Response to up early with launchd
Pingback: found_drama » Blog Archive » Lingon