58b49fd741ebb3668f5edf7dabebee208b7d38ec
[feisty_meow.git] / scripts / database / serene_backer_upper.sh
1 #!/bin/bash
2
3 function check_if_failed()
4 {
5   if [ $? -ne 0 ]; then
6     echo "Step failed: $*"
7     return 1
8   fi
9 }
10
11 function exit_if_failed()
12 {
13   check_if_failed
14   if [ $? -ne 0 ]; then
15     exit 1
16   fi
17 }
18
19 # just undo it first, to try to be sure we know we are mounted properly later.
20 umount /z/backup &>/dev/null
21
22 # now saddle up the backup.
23 mount /z/backup/
24 exit_if_failed "mounting backup folder"
25
26 # we should always be synching to an existing set in there.  make sure they exist.
27 # for the first ever backup, this is not a good check...
28 #test -d /z/backup/etc -a -d /z/backup/home
29 #exit_if_failed "testing presence of prior backup"
30
31 ##############
32
33 synch_files /etc /z/backup/etc/
34 check_if_failed "synching etc to backup"
35
36 ##############
37
38 synch_files /home/albums /z/backup/home/albums
39 check_if_failed "synching home/albums to backup"
40
41 synch_files /home/deepcore /z/backup/home/deepcore
42 check_if_failed "synching home/deepcore to backup"
43
44 synch_files /home/drupal /z/backup/home/drupal
45 check_if_failed "synching home/drupal to backup"
46
47 synch_files /home/fred /z/backup/home/fred
48 check_if_failed "synching home/fred to backup"
49
50 synch_files /home/git /z/backup/home/git
51 check_if_failed "synching home/git to backup"
52
53 synch_files /home/sharedspam /z/backup/home/sharedspam
54 check_if_failed "synching home/sharedspam to backup"
55
56 synch_files /home/sim /z/backup/home/sim
57 check_if_failed "synching home/sim to backup"
58
59 synch_files /home/svn /z/backup/home/svn
60 check_if_failed "synching home/svn to backup"
61
62 synch_files /home/trac /z/backup/home/trac
63 check_if_failed "synching home/trac to backup"
64
65 ##############
66
67 synch_files /var/lib/mailman /z/backup/var/lib/mailman
68 check_if_failed "synching var/lib/mailman to backup"
69
70 ##############
71
72 umount /z/backup/
73 exit_if_failed "unmounting backup folder"
74
75