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:


#!/bin/sh

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

# 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.

This entry was posted in darwin, sysadmin. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.