Launching a backup with launchd

Six years ago, I posted about using rsync to backup a web server (many of the difficulties mentioned there have since been fixed). I’m finally getting around to switch from using cron to run that backup to using the new hotness: launchd. This task was made easier by Preston Holmes’ cron to launchd converter.

To summarize the prior post, I have a special user on my Mac named “backup”. The only thing this user does is backup other stuff, such as my web server. This user has a script (shown in the previous post) in ~/Documents/webbackup. I want this script to run at, say, 2:30am as this backup user, even if no one is logged on. To do this with launchd, I first need a file describing the job:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "">
<plist version="1.0">
  <!-- Write this file to /Library/LaunchDaemons/ -->


While there are ways to run this job using launchctl, if you want it to run automatically, unassisted, even after rebooting your machine, you need to write the file to /Library/LaunchDaemon/com.mycompany.webbackup.plist. Note, that is /Library, not ~/Library, so you will likely need to use sudo to get the file there.

Also note that the name of the file should match the “Label” key in the file, with .plist suffix. Note also that this “Label” is used as a unique id, so if you make more than one of these job descriptions you need to change both the filename and the “Label” key.

A television in every back yard, mark I

With football season starting, it’s important to get in some quality outdoor viewing before it gets to cold and nasty, particularly if you just spent way too much to redo your back yard. So…can you see the television stand in this back yard? Can your spouse?

No you can't

No, you can’t, because it isn’t there. You need a sturdy place to mount a TV outside, but one that doesn’t blight the landscape when the TV isn’t in use.

This post details my first attempt at producing such a stand. The idea is to build it out of sturdy piping that slides into anchor holes embedded into the ground. This gives the TV a sturdy base when you want it, but lets you pull the whole thing out and store it in a shed when you don’t, leaving almost no trace. I’m still experimenting with it, but this first attempt works pretty well so far.


LayoutMost of the materials for this stand can be found at Lowe’s or Home Depot, and are not hugely expensive. Most of these you will probably need to adapt to your particular needs, but here is what I used:

Even before gathering all of these together, though, you need to think your plan through. If you have a particular place you want the TV outside, before going through the trouble of building this stand, just set the TV up on a table close to where you want it and see how the picture works outside. In particular, does the glare from the sun obscure the picture? If so, you probably want a different spot.

Also, can you get power to where you want the TV? How about a signal (cable, satellite, etc.). Make sure you have all that figured out before you dive too deeply into this project.


The PVC pipe should just barely slide around the galvanized piping that you’ll use to make the main frame. The idea is that this PVC will be buried so that the tops just stick out of the ground, anchored in cement. There are probably easier ways to do this, but here is what I did.

Take the J-bend and connect the 12″ PVC pipe to the longer end. Mix up one of the 10 pound buckets of cement. Sink the J-bend as far as it will go into the cement, so that it is totally submerged, but the straight pipe sticks up out of the cement. Look down into the pipe and you should see at least of bit of cement that has oozed into the bottom from the submerged end. This is fine, and should anchor the pipe even better. The idea of using the J-bend here is that it should let the cement grab onto the whole thing better than just a straight pipe would.

Set something to hold the open end of the pipe up as straight as possible while the cement dries. I cut a cross in the lid of the bucket, but boards or something should work fine.

Repeat the process with the other J-bend.

I suppose you could just pour cement directly into the ground instead of using the buckets, but I found the buckets were pretty useful in making the frame, as you could test the fit, move it around, and the buckets were heavy enough to hold the frame up for painting, even without being buried.


Looking at the picture above, you can see how the galvanized pipes form an “H”, with the 36″ pipe at the center. Since this is precut pipe, it should all screw together easily, and the long pipes make good levers to get it assembled tightly. It may still twist a bit, but don’t worry about that so much now. In case it isn’t obvious, the left side of the picture below shows a close up of the T connections.


Once assembled, test out the fit of the frame into the anchor buckets. The bottom legs of the “H” should just slide into the PVC pipe sticking out of the cement. Try to avoid jamming the frame all the way in, as it can be hard to get out if you do.

Remove the frame from the anchors and lay it out on the floor. Position the TV mount onto the top section to see how it will fit. One caution here: make sure to position the TV mount such that, when the TV is on it, no part of it collides with the cross bar of the frame’s “H”. I didn’t think about this, and it turned out that the TV’s built-in stand (which lets it stand on its own on a table) wound up at the exact same level as the crossbar, so I have to remove the stand to mount it outside, and put it back on when I bring in the TV. Sort of annoying.

To connect the TV mount to the frame, you’ll need to drill holes into the pipes. The TV mount should give you a lot of choice on running a bold through the mount, then through the pipes. The right side of the picture above shows an example. Drilling the holes is difficult. You’ll need a 3/8″ drill bit capable of penetrating dense metal. I would drill the top holes first, then position the mount again for marking the bottom holes. Once the holes are drilled, leave the mount disconnected.

If your pipes are like mine, they will probably be a bit greasy. Wash them with soap and water, WD40 or whatever to get them clean. After they dry, prime the frame. I put the frame into the anchors to do this, wrapping painters tape around the PVC to keep the primer off of it. Painting it like this allows you to get all sides at the same time. Once the primer is dry, add the textured paint. The picture above shows the texture I used. I also gave a light coat of glossy black to the bolts, nuts and washers that will connect the mount to the frame.

Once everything is dry, connect the mount to the frame with the machine screws. Now you’re ready to take it outside.


PlantingPut the anchor buckets on the ground approximately where they should go, and slide in the frame. Mark the spots on the ground, then clear everything away and dig some post holes. You want them just deep enough that an inch or so of the PVC pip will stick out of the ground when you are done. As always, beware when you dig in your yard. Is there a gas line or a power cable or something running where you are about to dig? If you don’t know, find out first. This is the part of the job where the wrong chain of events could kill you.

Maneuver the anchors (frame still inside) into the holes. You’ll probably need to fine tune here, adding and removing dirt to get the frame level, or to make the holes slightly wider and so on. The key bit here is to keep the frame slid into the anchors. Doing that should ensure that the frame will line up correctly with the holes and slide out cleanly. Once you are satisfied, the whole assembly should probably be standing on its own in the holes (this is another benefit of making the anchor buckets separately).

At this point, I decided to add some more cement into the holes. You could probably use rocks, or just really good dirt packing instead. After filling in the empty space around the buckets with dirt, I mixed a 20 pound bucket of cement and poured it equally into both holes. Again, I kept the frame inside the anchors the whole time.

When it was dry, I filled the rest up with dirt and covered it in mulch. As planned about an inch of the PVC sticks out. I bought some capping to keep these covered when the frame is not in use. (If you look at the picture at the very start of this post, you can barely make out these caps in the ground.) Getting the frame out of the anchors the first time might be a bit difficult. Best way is with two people, standing on the anchor spots and pulling hard. You may want to try putting the frame in taking it out a few times, just in case.


The Peerless mount works using two basic pieces. One is a sort of rail, which is what you connected to the frame. To connect the TV onto this rail, the mount will come with something that screws into the back of the television (usually two bars that run vertically). These can just be left on the TV, even if the TV you use isn’t usually wall mounted (mine isn’t). Connect them according to the instructions that came with the mount. If your TV gives you a choice of mounting positions, connect the pieces as widely apart as possible.

With everything in place outside, test the strength of the frame. Mine is pretty sturdy, barely budging. I’m only using a 36″ television, but I’m fairly certain the stand could handle a larger one, but I haven’t experimented with that yet.

Connect the TV onto the mount. Typically, the parts of the mount slide together loosely, then you tighten some screws up to hold everything solidly. Follow your mount’s instructions.

TV back

Now run the power and signal to the TV. In my case, I can feed both through a window behind the stand, so there are no cords for people to trip on.


When it is all set up, it looks like this:

No you can't


Overall, I’m pretty pleased with how this stand turned out, with only three caveats. First, the mistake I made with the built-in stand hitting the crossbar makes setting up the TV and taking it down again more painful than I was planning. I might move the Peerless mount down slightly. This will leave some ugly holes, but I can live with that.

Second, I don’t have a great solution for holding the cable box yet. It would be nice to attach a shelf in some way to the frame to hold the box. I’ve thought about cutting slots for shelf brackets below the crossbar, and adding a shelf that way, but cutting the precisely into metal is hard. There is probably some type of shelf designed to clamp to piping, but I have yet to find one. If you have a great idea for this, leave a comment below (with links, if possible).

Lastly, the mount might be a bit too high. For something like a party, with people standing and milling around, it works pretty well. For sitting, it is just slightly tall. If the TV was bigger, this might not matter, as it would hang down slightly. I could easily take a hack saw to the legs of the frame, but I’m leaving it as is for now.

If you try building a stand like, let me know how it goes. And tell me what you changed. Cheers.


Pimp my cable box

My cable provider supplies a digital video recorder (DVR) that records high definition. It’s not a very good one, with possibly the ugliest user interface ever (from an application called SARA), but it’s adequate and gets the job done. Or did, until the DVR started to run out of disk space. It turns out that this particular cable box/DVR (a Scientific Atlanta 8300HD) has an external serial advanced technology attachment (eSATA) port on it. I happened to have some SATA drives left over from upgrading my RAID, so I thought I’d try to plug one of these in. This turned out to be a bit of a challenge.

The first task was to put the drive into something that supported the eSATA interface, which means getting a drive enclosure for the bare drive I had. I wanted this to be as versatile as possible, so I managed to find the OWC Mercury Elite-AL Quad Interface, which supports eSATA, USB2 and both flavors of FireWire. This case is quiet and solid, made largely from large pieces of aluminum. Mounting was easy, and I tested the drive on my Mac with no problem.

I also discovered a bit of a bonus: my MacPro has some spare SATA plugs on the motherboard, and the same company that sells the case sells a cheap doohickey that plugs into these ports, and exposes them as eSATA ports on the back of the machine. Simple, inexpensive and useful.

Anyway, connecting this drive into the cable box didn’t work. It turns out that the DVR is very finicky about both the drive and the enclosure that it talks to. Since its all standard interfaces, this is both stupid and irritating, but it seems to only accept certain combinations. My drives were Maxtor drives and didn’t seem to work. Possibly they are less standard than usual.

By this time, we were really running out of space, and I got a bit obsessed about gaining extra storage for the damn thing. I wound up finding a solution made specifically for the Scientific Atlanta 8300HD, with a money back guarantee if it didn’t work. This meant getting a whole new drive, so wasn’t the most cost effective thing to do. Still, I can use the Mercury Quad for other things, so it’s not a total loss. It was also an excuse to get a larger drive than that one I had.

From opening the box, it took all of five minutes to get this drive working with my cable box. Very simple, really quiet, works great, and roughly quadrupled our DVR recording ability. So, pretty happy with it, though a bit beyond the original budget. I have yet to try to unmount the drive and read it with a computer. From what I read, this doesn’t really work that well.

This summer, we also totally upgraded our main TV area, adding a Playstation 3 and flatscreen TV (which necessitated a new receiver that could handle HDMI, and lots of it). After connecting it all, and resurrecting some old hardware to make the 802.11n connection a bit more reliable, our setup now looks like this:

Network diagram

The ten-minute 1TB backup RAID installation

The Mac Pro contains four accessible hard-drive bays. Mac OS X comes with easy to use RAID software. Put these together, and you can quickly build a backup system using redundant disks, so that if one drive fails, another takes its place.

Building a RAID (meaning “redundant array of independent disks”) like this may be ideal for backups, but isn’t as useful for other applications of RAID technology (such as striping for great video encoding performance, and so on). This because the RAID is controlled by software, so is on the slower side. It’s possible to put an optional hardware-based RAID controller into the Mac Pro, but it is pricey and complete overkill for backups. The speed doesn’t really matter for backup use, especially when using Time Machine, since it is all done unnoticed in the background anyway.


The key thing about making a RAID is that you need to use multiple identical disks. As mentioned, speed doesn’t really matter for backups. In fact, you are usually better off buying the slowest disks you can find because they a) will still be fast enough, b) are cheaper, c) are usually quieter and d) usually draw less power. The Mac Pro uses Serial Advanced Technology Attachment (Serial ATA or SATA) disks. The drives used in this post are a pair of 1.0TB Western Digital Caviar Geen drives, due to their lower power consumption and sound output. These drives use a variable number of rotations per minute, but are rated at between 5400 and 7200 rpm. So, these are not speed demons, but they don’t need to be. At the time of writing, Other World Computing had the best deal on this particular drive.

In addition to the drives, you will need a Mac Pro, one functional hand, and a standard phillips screwdriver. You might also want a grounding strap to prevent electrical damage to the components, particularly in dry climates or if you tend to get shocked by light switches a lot where you live.

To start the installation, shutdown your Mac Pro.

Hardware installation

Pull out the tab on the back of the Mac Pro, pull the top of the side panel out, then remove the side panel (click on any of the images in this post to see a larger version):

Open Remove side

About a third of the way down, find the four numbered drive caddies. If this is a new machine, chances are that drive bay #1 holds the primary disk and the other three caddies are empty. These instructions assume that this is the case, and that you’ll put your RAID drives into bays #2 and #3. Adjust this to match your machine accordingly. It doesn’t matter which of the bays the RAID drives are in. Give a tug to caddy #2 (or whatever) and slide it out. It should come out without much effort; it is not secured with screws or anything:

Remove caddy #2 Caddy

Before unwrapping your drive from its anti-static bag, hold the bag and touch a metal part on the frame of the Pro. This should lessen the chance of a spark that could damage the drive. Unwrap the first drive and find the four silver holes at the edge of the side with the visible circuit board. Note that these are in the same orientation as the screws on the caddy. Line the caddy up with these holes and connect with a phillips screwdriver. Note that the “open” end of the caddy should point towards the back of the drive (where the copper pins are).

Drive and caddy Attached caddy

Put the caddy with the mounted drive back into the machine by locating the tab-like rails into which the caddy slides. These should fit very naturally. Once in place, slowly but firmly push the caddy all the way back in. It should be flush with the rest of the caddies.

View from below Sliding drive back in

Repeat the process with the second drive, using bay #3. Once done, replace the side panel by lining up the bottom of it with the space in the machine, then tilting the top back in place. Once flush, close the tab on the back of the machine to lock the side in place. Boot the Mac Pro.

Software setup

If all goes well, once you boot up, you will see messages asking you if you want to format the new drives. Say no to (or cancel) these messages. You’ll need to reformat these drives as a RAID, so no point in formatting them just now. Instead, launch the “Disk Utility” application (usually found in Applications/Utilities).

When it comes up, you should see the new drives listed on the left, along with your primary drive and your DVD drive. From the tab selections at the top of the right-hand section of the window, click “RAID”. Enter a name for your new RAID, such as “Backup”. Make sure “Raid Type:” is set to “Mirrored RAID set”.

RAID panel Mirrored RAID

Now select one of the new drives from the list at the left. Holding down the shift key, click on the other new drive, to add it to the selection as well. Drag the two selected drives into the large white space on the right-side section of the window. This will add two entries to this list, saying something like “New member: ‘disk 0′”. Below this list, click “Options”. Make sure “Automatically rebuild RAID mirror sets” is checked, and click “OK”. (This setting will correct problems in the RAID if one of the drives has an error.)

Dragging the drives RAID options

Click “Create”. A confirmation screen will come up, warning you that creating this RAID will completely erase the drives. This is a good time to make doubly sure that you have selected your new drives into the RAID, and not any other drives. When satisfied this is so, click “Create”. A progress bar will appear as the RAID is being created. When finished, you should see the new RAID show up in both the left side list, and in the right side section. While the Disk Utility will still show you the individual disks, everything else will see the RAID as if it is a single drive.

Confirmation screen Ready RAID

Note that the capacity of the RAID as a whole matches that of one of the drives, not their sum. This should be as you would expect. The whole point of the RAID is to act as a “virtual disk” and when a byte is written to that disk, the RAID software writes that byte to the same spot on both of the drives, making sure they each have a copy of the same data. Thus, either one can fail, and you still have a working copy of the data.

A short digression

Before setting up this RAID for use with Time Machine, a quick digression. For troubleshooting purposes, it is sometimes useful to get more information about the drives you are using. Six months down the road, for example, you might have forgotten which drive you put into which bay. The System Profiler application can provide a bunch of information about your system, including the drives. You can launch this app either directly from Applications/Utilities or by selecting “About This Mac” from the Apple menu, then clicking “More Info…”.

Once the System Profiler launches, clicking the “Serial-ATA” section will show a list of the drives in the machine. If you click on one of your new drives, the bottom right section will display all sorts of information about the drive. Two more useful bits of information are the “Bay Name” setting, which tells you in which drive bay the drive is physically installed, and the “BSD Name” field, usually set to something like “disk1s3”. This code is needed for a number of command line disk manipulation tools, so is good to know when troubleshooting problems.

About This Mac System Profiler

Time Machine

Setting up Time Machine to use this RAID is the same as using any other drive. Just “Open Time Machine Preferences” from the Time Machine menu icon (by the clock in the menu bar), or by selecting “System Preferences…” from the Apple menu, then going to the Time Machine section. Once there, turn Time Machine on and select the RAID.

Time Machine


Although I’ve used Duover for backups until now, I’ve decided to stop using it for two reasons. The first is that it seems to be floundering with the release of Leopard, making backups incredibly slowly, and generally flaking out. As an example, a daily backup from my kitchen machine took about 20 minutes under Tiger but, even with the latest Duover update, was taking over four days under Leopard. Not at all useful. Secondly, Time Machine is just really useful and cool.

So, I’ve just installed a 1TB Time Capsule backup device into my home network. It’s been a real breeze to setup, even for an Apple product. Simply just works. Even though I was pretty sure it would do what I wanted it to, I had a nagging suspicion that my network setup might trip it up, but this turned out to be groundless. My home uses two different wireless networks, one using 802.11g, to serve the older machines, and one using 802.11n to serve the newer machines at the best speed. (Hardware that runs 802.11n can also support 802.11g simultaneously, but doing so really slows down the 802.11n portion.) The additional speed on the 802.11n network makes a huge difference when streaming HD video to the Apple TV (though the g network can handle DVD level video just fine). My setup works basically like this:

Network diagram

I wasn’t 100% sure the kitchen machine (“Nexus”) would be able to see the backup service, but it works fine, just as a good network service should. As long as the machine and the device are on the same LAN, it appears to make no difference how it actually gets there, just as you’d expect. (That initial backup sure is slow, though.)

Easter turducken

Most traditional holidays are syncretised perversions of even older traditions, which then get secularized into excuses to eat a whole bunch. Christmas falls, not coincidentally, close to the winter solstice, and borrows heavily from earlier winter festivals, featuring lots of gingerbread, candy canes, traditional hams and large family feasts. Thanksgiving, being largely a continuation of post-harvest feasts in Europe, has always been about eating. We have, of course, taken this to ridiculous extremes with turducken, a Thanksgiving dish prepared by…

…cramming a boneless chicken into a boneless duck, which is stuffed into a boneless turkey. Three kinds of stuffing are layered between the three kinds of meat and the monstrosity is cooked for a very long time. The end result, when cut, is a fantastic food rainbow that must be eaten to be believed.

Easter, which may or may not have been named after a pagan fertility goddess, falls conveniently close to the spring equinox, allowing the syncresis of rabbits, eggs and the rebirth of nature into a ritual about the slaughter and rebirth of God. Easter also now has been subverted into being about eating, though hasn’t yet been taken to the extremes of Thanksgiving turducken.

Until now.

Making Easter turducken is, fortunately, much easier than a traditional turducken, as it abandons all that pesky protein while fully embracing the empty carbohydrates and fat. While technically Easter turducken is a dessert and traditional turducken a main course, they should never be consumed in the same meal. That would be heresy.

As with traditional turducken, Easter turducken starts from the inside out. The core is formed with miniature Cadbury cream eggs:

Take an ordinary peep and make a large slit in the bottom, as deep as possible without going all the way through:

Stuff an egg into the slit, stretch the sides around it, and fold the peep’s tail down. Repeat with a few more peeps.

The outer layer finally makes good use of one of the more odious culinary travesties, the irritating hollow bunny. As a kid, nothing was more annoying that thinking you’d been given a huge block of chocolate, and it turns out to be empty. To get the egg-stuffed peep goodness into this abomination, first you must open the bottom. Anything worth doing is worth doing with power tools, so take a dremel and cut around the perimeter of the bottom:

Once the hole is made, stuff the now egg-bloated peeps into the bunny. Note that some hollow bunnies suck even more than others, and crack and fall apart really easily, so be careful. Once you’re done, put the bottom back on. The really ambitious might try re-melting the seam in the bottom closed with a crème brûlée torch.

Voilà, the loathsome hollow bunny is transformed into several thousand calories, as God intended. Many children wonder around Easter how it is that bunnies lay eggs. As a side benefit, Easter turducken illustrates clearly that this “theory” is wrong. Obviously bunnies lay chickens, which then lay the eggs. Mystery solved.

Now fully prepared, the Easter turducken can be eaten. There is probably some kind of psychological test about what part of the bunny you eat first. I always go for the neck. Since it is held together only by a cheap-ass hollow bunny, once you start eating your turducken, it will collapse rapidly. Be prepared for a mess.

Yummy. A guess at the nutrition information for a three peep turducken:

Nutrition Facts
Serving Size:
  1 Easter turducken • 98g

Amount Per Serving
Calories  456 Calories from Fat  158
% DV*
Total Fat  18g 27%
    Saturated Fat  11g 44%
    Trans Fat  0g  
Cholesterol < 15mg 4%
Sodium  74mg 4%
Total Carbohydrate  70g 24%
    Dietary Fiber  0g 0%
    Sugars  65g  
Protein  6g 11%

Enjoy your Easter turducken. And bring lots of paper towels. And maybe a bib. Let me know how your own turn out.