From ffb924491bd96b2b23ca859c30c1980fd9447996 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Tue, 22 Dec 2015 23:39:06 +0000 Subject: [PATCH] Disable backup verify --- src/freedombone-backup-local | 24 +++++++++++++++--------- src/freedombone-backup-remote | 24 +++++++++++++++--------- 2 files changed, 30 insertions(+), 18 deletions(-) diff --git a/src/freedombone-backup-local b/src/freedombone-backup-local index 9fc85b87..5ced2e9d 100755 --- a/src/freedombone-backup-local +++ b/src/freedombone-backup-local @@ -31,6 +31,7 @@ PROJECT_NAME='freedombone' COMPLETION_FILE=$HOME/${PROJECT_NAME}-completed.txt BACKUP_EXTRA_DIRECTORIES=/root/backup-extra-dirs.csv +ENABLE_VERIFICATION="no" export TEXTDOMAIN=${PROJECT_NAME}-backup-local export TEXTDOMAINDIR="/usr/share/locale" @@ -60,6 +61,9 @@ fi function suspend_site { # suspends a given website + if [[ $ENABLE_VERIFICATION != "yes" ]]; then + return + fi SUSPENDED_SITE="$1" nginx_dissite $SUSPENDED_SITE service nginx reload @@ -202,16 +206,18 @@ function backup_directory_to_usb { fi obnam force-lock -r $USB_MOUNT/backup/${2} --encrypt-with $MY_BACKUP_KEY_ID ${1} obnam backup -r $USB_MOUNT/backup/${2} --encrypt-with $MY_BACKUP_KEY_ID ${1} - obnam verify -r $USB_MOUNT/backup/${2} --encrypt-with $MY_BACKUP_KEY_ID ${1} - if [ ! "$?" = "0" ]; then - umount $USB_MOUNT - rm -rf $USB_MOUNT - if [[ ${1} == "/root/temp"* || ${1} == *"tempbackup" ]]; then - shred -zu ${1}/* - rm -rf ${1} + if [[ $ENABLE_VERIFICATION == "yes" ]]; then + obnam verify -r $USB_MOUNT/backup/${2} --encrypt-with $MY_BACKUP_KEY_ID ${1} + if [ ! "$?" = "0" ]; then + umount $USB_MOUNT + rm -rf $USB_MOUNT + if [[ ${1} == "/root/temp"* || ${1} == *"tempbackup" ]]; then + shred -zu ${1}/* + rm -rf ${1} + fi + restart_site + exit 71 fi - restart_site - exit 71 fi obnam forget --keep=30d -r $USB_MOUNT/backup/${2} --encrypt-with $MY_BACKUP_KEY_ID if [ ! "$?" = "0" ]; then diff --git a/src/freedombone-backup-remote b/src/freedombone-backup-remote index 2a16985b..34c3a02e 100755 --- a/src/freedombone-backup-remote +++ b/src/freedombone-backup-remote @@ -32,6 +32,7 @@ PROJECT_NAME='freedombone' COMPLETION_FILE=$HOME/${PROJECT_NAME}-completed.txt CONFIG_FILE=$HOME/${PROJECT_NAME}.cfg BACKUP_EXTRA_DIRECTORIES=/root/backup-extra-dirs.csv +ENABLE_VERIFICATION="no" export TEXTDOMAIN=${PROJECT_NAME}-backup-remote export TEXTDOMAINDIR="/usr/share/locale" @@ -72,6 +73,9 @@ SUSPENDED_SITE= function suspend_site { # suspends a given website + if [[ $ENABLE_VERIFICATION != "yes" ]]; then + return + fi SUSPENDED_SITE="$1" nginx_dissite $SUSPENDED_SITE service nginx reload @@ -100,16 +104,18 @@ function backup_directory_to_friend { fi obnam force-lock -r $SERVER_DIRECTORY/backup/${2} --encrypt-with ${ADMIN_BACKUP_KEY_ID} ${1} obnam backup -r $SERVER_DIRECTORY/backup/${2} --encrypt-with ${ADMIN_BACKUP_KEY_ID} ${1} - obnam verify -r $SERVER_DIRECTORY/backup/${2} --encrypt-with ${ADMIN_BACKUP_KEY_ID} ${1} - if [ ! "$?" = "0" ]; then - if [[ ${1} == "/root/temp"* || ${1} == *"tempbackup" ]]; then - shred -zu /root/temp${2}/* - rm -rf /root/temp${2} + if [[ $ENABLE_VERIFICATION == "yes" ]]; then + obnam verify -r $SERVER_DIRECTORY/backup/${2} --encrypt-with ${ADMIN_BACKUP_KEY_ID} ${1} + if [ ! "$?" = "0" ]; then + if [[ ${1} == "/root/temp"* || ${1} == *"tempbackup" ]]; then + shred -zu /root/temp${2}/* + rm -rf /root/temp${2} + fi + # Send a warning email + echo "Unable to verify ${2}" | mail -s "${PROJECT_NAME} backup to friends" ${ADMIN_EMAIL_ADDRESS} + restart_site + exit 953 fi - # Send a warning email - echo "Unable to verify ${2}" | mail -s "${PROJECT_NAME} backup to friends" ${ADMIN_EMAIL_ADDRESS} - restart_site - exit 953 fi obnam forget --keep=30d -r $SERVER_DIRECTORY/backup/${2} --encrypt-with ${ADMIN_BACKUP_KEY_ID} if [ ! "$?" = "0" ]; then