Overengineering is Bestengineering
Thursday, May 27th, 2010As you may know, I’m a big fan of what I’d consider the JWZ PSA style of data backup for my home systems (none of them are really pretentious enough to even be considered servers). For a while I’ve been continuing to expand on the list of –exclude options I’d been passing to rsync. But no more! At long last my tolerance for rambling rsync options was exhausted.
So of course I turned it into a script. This script.
#!/bin/bash
EXCLUDES=`mktemp --tmpdir=/tmp rsyncex.XXXXXX`
RSYNCFLAGS="-q"
while getopts "v" Option
do
case $Option in
v ) RSYNCFLAGS='-v';;
* ) echo "Only know -v for verbose" ;;
esac
done
(
cat <<'EOL'
*.lock
/proc/*
/sys/*
*/tiger/work/*
*/nagios3/spool/*
tmp/*
/tmp/*
/opt/splunk/var/*
/var/www/munin/*
EOL
) > ${EXCLUDES}
# as an idle job if you can
/usr/bin/ionice -c 3 -t \
/usr/bin/rsync -xa ${RSYNCFLAGS} --links \
--exclude-from=${EXCLUDES} --delete / /mnt/backup
rm ${EXCLUDES}
The points at which you would want to modify it for your own use should be obvious, if not the point of why you would want to use it at all.
