May28
Backing up my iPhoto and iTunes libraries
I want to have an on-site and an off-site backup of my important files. This documents the first steps, to make sure the iPhoto and iTunes libraries are properly backed up.
rsync works well for me in other chores, so I decided to use it for this part of the backup. For personal documents that may be updated on other PCs, I’ll probably use Unison. However, I only add pictures and music on the Mac.
The shell script that actually does the backup looks like this:
#!/bin/bash
# Backup all my important media to the home server
#
# Configuration of programs, options, etc.
SYNCPRG="/usr/bin/rsync"
BACKUPHOST="backuphostname"
#
# Areas to backup
PHOTO_SRC="/Users/jcmendez/Pictures/iPhoto Library/"
PHOTO_DST="/backupdst/data/iphoto"
MUSIC_SRC="/Users/jcmendez/Music/iTunes/"
MUSIC_DST="/backupdst/data/itunes"
#
# The actual commands
$SYNCPRG -a "$PHOTO_SRC" $BACKUPHOST:$PHOTO_DST
$SYNCPRG -a "$MUSIC_SRC" $BACKUPHOST:$MUSIC_DST
To run periodically, even if I’m not logged in, I added to Library/LaunchDaemons the following file:
< ?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">
In the code above backupscriptname is the name and location of the bash script shown.
To install it in the LaunchDaemons folder, administrative rights are needed:
sudo mv mendez.daily-backup.plist /Library/LaunchDaemons/
Finally, I told launchd about the new service with
sudo launchctl
Launchd has a shell, where you can learn more about the commands accepted. Another alternative is to give the commands after launchctl
To load the service:
launchd% load mendez.daily-backup
And finally to verify that the service is up:
launchd% list
References:
http://developer.apple.com/macosx/launchd.html
No related posts.
Sorry, the comment form is closed at this time.
Sorry, the comment form is closed at this time.