From df435417f4a36cb841389e78bc4ea3784f7d76d3 Mon Sep 17 00:00:00 2001 From: Chris Koeritz Date: Wed, 19 Sep 2012 13:31:17 -0400 Subject: [PATCH] moved to better folder, and updated with more goodness. --- .../serene_backer_upper.sh | 29 ++++++++++++++----- 1 file changed, 21 insertions(+), 8 deletions(-) rename scripts/{database => archival}/serene_backer_upper.sh (65%) diff --git a/scripts/database/serene_backer_upper.sh b/scripts/archival/serene_backer_upper.sh similarity index 65% rename from scripts/database/serene_backer_upper.sh rename to scripts/archival/serene_backer_upper.sh index 8a2cbcb0..9ac48ac5 100644 --- a/scripts/database/serene_backer_upper.sh +++ b/scripts/archival/serene_backer_upper.sh @@ -1,5 +1,11 @@ #!/bin/bash +# backs up crucial directories on my server into the allotted backup area. +# +# Author: Chris Koeritz + +# tests whether the last action worked or not, and if not, it issues the +# complaint passed as the arguments. function check_if_failed() { if [ $? -ne 0 ]; then @@ -8,6 +14,8 @@ function check_if_failed() fi } +# uses the failure checking function, but actually exits out of the script +# if there was a failure detected. function exit_if_failed() { check_if_failed @@ -16,6 +24,7 @@ function exit_if_failed() fi } +# given a source and target folder, this synchronizes the source into the target. function synch_to_backup() { local source="$1"; shift @@ -25,18 +34,22 @@ function synch_to_backup() exit 1 fi echo "Synchronizing $source into $dest." -#hmmm: temporary measure until top-level dir bug fixed in synch_files app. - if [ ! -d "$dest" ]; then - mkdir -p "$dest" - if [ $? -ne 0 ]; then - echo "FAILed to make target directory: $dest" - return 1 - fi - fi +####hmmm: temporary measure until top-level dir bug fixed in synch_files app. +### if [ ! -d "$dest" ]; then +### mkdir -p "$dest" +### if [ $? -ne 0 ]; then +### echo "FAILed to make target directory: $dest" +### return 1 +### fi +### fi synch_files "$source" "$dest" check_if_failed "synching $source to $dest" } +############## + +# main body of script... + # just undo it first, to try to be sure we know we are mounted properly later. umount /z/backup &>/dev/null -- 2.34.1