Use a shell script for incremental backups
Oct 07, '05 06:08:00AM
Contributed by: plmc
This shell script is a modification of a script I've been using on Unix systems since the late 80's. I recently updated it for use on 10.3, and it should work on 10.4 as well. Here's a reformatted version of the instructions, which are commented in the script:
Description: UNIX Incremental Backup script
This script will back up any files newer then a touch file located in /, and will log each file it backs up. Log files are overwritten once a week.
- To use this script, create the following directories: /usr/local/bin and /usr/local/logs.
- Then execute the command touch /.inc_mark.
- Create a full backup of the dirs you want to do incremental backups for, using a command similar to this: find /Users -print | cpio -pdumv /Volumes/Backup
- Schedule the script using crontab, launchd, or something similar.
[robg adds: While I haven't tested the full script, I did test the cpio command to see how it handles files with resource forks (there's no mention of such files in its man pages). Happily, it seemed to handle them just fine, as I was able to open a selection of "resource forked" files that I copied across drives via the cpio command. Please read the script and modify as necessary -- there are some hard-coded paths you'll want to replace. You'll also need to use sudo to create the above-mentioned directories.]
Comments (10)
Mac OS X Hints
http://hints.macworld.com/article.php?story=20051005204725280