Structure and Interpretation of Computer Programmers

I make it easier and faster for you to write high-quality software.

Saturday, May 12, 2007

A bit of backup script

Good news – there’s a handy tool in OS X called wait4path which can help when writing timed scripts to backup to removable media.

Bad news – it [at least in Tiger….] works slightly esoterically – if a path is already present, it will still wait for another mount kevent before exiting. It should therefore be used in a script like this:


if [ ! -d /Volumes/Backups ]; then
echo "waiting for backup volume..."
/bin/wait4path /Volumes/Backups

# do some backups

Note, however, that if you do this in a crontab job it could potentially wait for a very long time, so you should wrap all that with a /var/run style semaphore.

posted by Graham Lee at 12:48  

Friday, May 11, 2007

Official Google Mac Blog: Measuring performance of distributed notifications

Official Google Mac Blog: Measuring performance of distributed notifications on the performance of Google Update: “Just how expensive is it? How many notifications can you broadcast per second? As with all Google client products, we want to be good citizens and not bog down the client machine.”

A noble sentiment, but dear Google, answer me this: just how many times per second is each app going to be checking for updates? When does this become an important factor, and not a question of premature optimisation? They decided to go for distributed notifications instead of distributed objects, which seems reasonable – not because of the overhead issues (in fact a DO is probably a lot cheaper, if written properly), but because of the kind of information they’re trying to get through this IPC.

posted by Graham Lee at 19:47  

Thursday, May 3, 2007

Bye bye data, hello…the same data

Of course it happens to everyone, and yesterday evening it happened to me…my home directory became inaccessible. What seems to have happened is that the filevault image containing my ~ became corrupted upon unmounting (though notably, I didn’t do the ‘recover space’ thing the last time I logged out before the failure, so it should just have been a straightforward unmount). so the simplest recovery route was to delete the user, re-create it then recover my data from the backups. I don’t keep backups of the Library area so lost a few preference files, and of course have had to trawl around my email looking for licence keys and the like.

For the moment I’ve set up the replacement user without Filevault, and am using encrypted disk images for specific data I’d rather keep thus protected. This makes backups harder – I keep my backup drive unencrypted as it doesn’t come out with me, so I now need to come up with a script to backup my home dir except for the encrypted images, mount the images and back up the content, then unmount them. This means that the backup will need to be manually triggered so that passwords don’t have to be kept anywhere…or I write my own backup tool, which uses passwords stored in a keychain kept outside the target user account; and I need to make sure that keychain is also recoverable ;-).

A lot of my data was completely unaffected – work stuff is typically stored in subversion on their servers (as well as another local copy on my work laptop), my email is all on remote servers, my calendar is served by and so on. There are some improvements I could make – I could probably use an LDAP server and abxldap to remotify my contact list, and offers subversion hosting which I’m currently not making use of. But it happens that next Tuesday, I’ll be talking about data security at the Oxford Mac Users Group, so I will expand on this tale in full and gory detail ;-). St. Cross College, Tuesday 8th May, 7:30 pm.

Update 20070503T1653Z+0000: actually, things look a little more serious than simply a trashed sparseimage:

mabinogi:~/Desktop leeg$ hdiutil attach OmniDazzle-1.0.1.dmg
load_hdi: timed out waiting for driver to load
load_hdi: timed out waiting for driver to load
load_hdi: timed out waiting for driver to load
load_hdi: timed out waiting for driver to load
load_hdi: timed out waiting for driver to load
2007-05-03 15:41:35.535 diskimages-helper[718] ERROR: unable to load disk image driver – 0xE00002C0/-536870208 – Device not configured.

Good news is that when that gets fixed, my old homedir will start working again. Bad news is: um, it looks fairly messed up to me :-(

posted by Graham Lee at 13:30  

Powered by WordPress