Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
executable file 60 lines (45 sloc) 1.64 KB
#!/bin/bash
DATE=`date +%Y%m%d`
# Mirror or dump Subversion repositories
printf "%-40s" " * syncing subversion repositories"
SVMREPOS=~/backup/svn/pep svn-mirror sync / > /dev/null
svnadmin dump ~/svn/repo -q > ~/backup/svn/rjbs.svndump
echo '[ok]'
# update offline mailstore; don't use offlineimap, it's slow, and we never want
# to sync back to the server
printf "%-40s" " * syncing Maildir"
rsync --delete -ave ssh zodiac:~/Maildir ~/backup/ > /dev/null
echo '[ok]'
# make a scratch space for the backup files
mkdir /tmp/backup-$DATE
# tarbals to back up
printf "%-40s" " * building misc. backup tarball"
tar jcf /tmp/backup-$DATE/misc.tar.bz2 backup/{bin,code,documents,lib,music,svn,git}
echo '[ok]'
printf "%-40s" " * building maildir tarball"
tar jcf /tmp/backup-$DATE/maildir.tar.bz2 backup/Maildir
echo '[ok]'
printf "%-40s" " * updating flickr backup"
./bin/flickr-backup > /dev/null
echo '[ok]'
printf "%-40s" " * building photo tarballs"
tar jcf /tmp/backup-$DATE/flickr.tar.bz2 backup/flickr
tar jcf /tmp/backup-$DATE/pictures.tar.bz2 backup/pictures
echo '[ok]'
# build the iso we're going to burn to DVD
printf "%-40s" " * building iso"
mkisofs -J -r -V backup-$DATE -o backup-$DATE.iso /tmp/backup-$DATE > /dev/null
echo '[ok]'
# once that's done, we can get rid of the source material
rm -rf /tmp/backup-$DATE
# We can't use cdrecord blanking becase... well, it doesn't work.
# Even this isn't recommended, but hey, it seems to do the trick.
printf "%-40s" " * blanking dvd"
dvd+rw-format -force /dev/hdc
echo '[ok]'
# Burn the DVD
printf "%-40s" " * burning dvd"
cdrecord dev=/dev/hdc backup-$DATE.iso
echo '[ok]'
# ...and clean up
rm backup-$DATE.iso