3 # backs up crucial directories on my server into the allotted backup area.
5 # Author: Chris Koeritz
7 # given a source and target folder, this synchronizes the source into the target.
8 function synch_to_backup()
10 local source="$1"; shift
11 local dest="$1"; shift
12 if [ -z "$source" -o -z "$dest" ]; then
13 echo synch_to_backup function requires a source and a target folder to synch.
16 echo "Synchronizing $source into $dest."
17 synch_files "$source" "$dest"
18 test_or_continue "synching $source to $dest"
23 # main body of script...
25 # just undo it first, to try to be sure we know we are mounted properly later.
26 #NO LONGER USING MOUNT: umount /z/backup &>/dev/null
28 # now saddle up the backup.
29 #NO LONGER USING MOUNT: mount /z/backup/
30 #NO LONGER USING MOUNT: test_or_die "mounting backup folder"
32 # we should always be synching to an existing set in there. make sure they exist.
33 # for the first ever backup, this is not a good check...
34 #test -d /z/backup/etc -a -d /z/backup/home
35 #test_or_die "testing presence of prior backup"
39 synch_to_backup /etc /z/backup/etc/
43 for subdir in fred/Maildir git sharedspam svn trac www-data ; do
44 synch_to_backup /home/$subdir /z/backup/home/$subdir
49 synch_to_backup /var/lib/mailman /z/backup/var/lib/mailman
50 synch_to_backup /var/lib/mysql /z/backup/var/lib/mysql
54 #NO LONGER USING MOUNT: umount /z/backup/
55 #NO LONGER USING MOUNT: test_or_die "unmounting backup folder"