script to backup home and etc to off-machine storage.
authorChris Koeritz <fred@gruntose.com>
Tue, 3 Jul 2012 20:26:35 +0000 (16:26 -0400)
committerChris Koeritz <fred@gruntose.com>
Tue, 3 Jul 2012 20:26:35 +0000 (16:26 -0400)
does not work yet because synch_files app is not able to handle that massive
of a synch on the home folder.

scripts/database/serene_backer_upper.sh [new file with mode: 0644]

diff --git a/scripts/database/serene_backer_upper.sh b/scripts/database/serene_backer_upper.sh
new file mode 100644 (file)
index 0000000..d201806
--- /dev/null
@@ -0,0 +1,32 @@
+#!/bin/bash
+
+function check_if_failed()
+{
+  if [ $? -ne 0 ]; then
+    echo Step failed: $*
+    exit 1
+  fi
+}
+
+# just undo it first, to try to be sure we know we are mounted properly later.
+umount /z/backup &>/dev/null
+
+# now saddle up the backup.
+mount /z/backup/
+check_if_failed "mounting backup folder"
+
+# we should always be synching to an existing set in there.  make sure they exist.
+# for the first ever backup, this is not a good check...
+test -d /z/backup/etc -a -d /z/backup/home
+check_if_failed "testing presence of prior backup"
+
+synch_files /etc /z/backup/etc/
+check_if_failed "synching etc to backup"
+
+synch_files /home /z/backup/home/
+check_if_failed "synching home to backup"
+
+umount /z/backup/
+check_if_failed "unmounting backup folder"
+
+