Disable backup verify

This commit is contained in:
Bob Mottram 2015-12-22 23:39:06 +00:00
parent 91a670f11b
commit ffb924491b
2 changed files with 30 additions and 18 deletions

View File

@ -31,6 +31,7 @@
PROJECT_NAME='freedombone' PROJECT_NAME='freedombone'
COMPLETION_FILE=$HOME/${PROJECT_NAME}-completed.txt COMPLETION_FILE=$HOME/${PROJECT_NAME}-completed.txt
BACKUP_EXTRA_DIRECTORIES=/root/backup-extra-dirs.csv BACKUP_EXTRA_DIRECTORIES=/root/backup-extra-dirs.csv
ENABLE_VERIFICATION="no"
export TEXTDOMAIN=${PROJECT_NAME}-backup-local export TEXTDOMAIN=${PROJECT_NAME}-backup-local
export TEXTDOMAINDIR="/usr/share/locale" export TEXTDOMAINDIR="/usr/share/locale"
@ -60,6 +61,9 @@ fi
function suspend_site { function suspend_site {
# suspends a given website # suspends a given website
if [[ $ENABLE_VERIFICATION != "yes" ]]; then
return
fi
SUSPENDED_SITE="$1" SUSPENDED_SITE="$1"
nginx_dissite $SUSPENDED_SITE nginx_dissite $SUSPENDED_SITE
service nginx reload service nginx reload
@ -202,16 +206,18 @@ function backup_directory_to_usb {
fi fi
obnam force-lock -r $USB_MOUNT/backup/${2} --encrypt-with $MY_BACKUP_KEY_ID ${1} 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 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 [[ $ENABLE_VERIFICATION == "yes" ]]; then
if [ ! "$?" = "0" ]; then obnam verify -r $USB_MOUNT/backup/${2} --encrypt-with $MY_BACKUP_KEY_ID ${1}
umount $USB_MOUNT if [ ! "$?" = "0" ]; then
rm -rf $USB_MOUNT umount $USB_MOUNT
if [[ ${1} == "/root/temp"* || ${1} == *"tempbackup" ]]; then rm -rf $USB_MOUNT
shred -zu ${1}/* if [[ ${1} == "/root/temp"* || ${1} == *"tempbackup" ]]; then
rm -rf ${1} shred -zu ${1}/*
rm -rf ${1}
fi
restart_site
exit 71
fi fi
restart_site
exit 71
fi fi
obnam forget --keep=30d -r $USB_MOUNT/backup/${2} --encrypt-with $MY_BACKUP_KEY_ID obnam forget --keep=30d -r $USB_MOUNT/backup/${2} --encrypt-with $MY_BACKUP_KEY_ID
if [ ! "$?" = "0" ]; then if [ ! "$?" = "0" ]; then

View File

@ -32,6 +32,7 @@ PROJECT_NAME='freedombone'
COMPLETION_FILE=$HOME/${PROJECT_NAME}-completed.txt COMPLETION_FILE=$HOME/${PROJECT_NAME}-completed.txt
CONFIG_FILE=$HOME/${PROJECT_NAME}.cfg CONFIG_FILE=$HOME/${PROJECT_NAME}.cfg
BACKUP_EXTRA_DIRECTORIES=/root/backup-extra-dirs.csv BACKUP_EXTRA_DIRECTORIES=/root/backup-extra-dirs.csv
ENABLE_VERIFICATION="no"
export TEXTDOMAIN=${PROJECT_NAME}-backup-remote export TEXTDOMAIN=${PROJECT_NAME}-backup-remote
export TEXTDOMAINDIR="/usr/share/locale" export TEXTDOMAINDIR="/usr/share/locale"
@ -72,6 +73,9 @@ SUSPENDED_SITE=
function suspend_site { function suspend_site {
# suspends a given website # suspends a given website
if [[ $ENABLE_VERIFICATION != "yes" ]]; then
return
fi
SUSPENDED_SITE="$1" SUSPENDED_SITE="$1"
nginx_dissite $SUSPENDED_SITE nginx_dissite $SUSPENDED_SITE
service nginx reload service nginx reload
@ -100,16 +104,18 @@ function backup_directory_to_friend {
fi fi
obnam force-lock -r $SERVER_DIRECTORY/backup/${2} --encrypt-with ${ADMIN_BACKUP_KEY_ID} ${1} 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 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 [[ $ENABLE_VERIFICATION == "yes" ]]; then
if [ ! "$?" = "0" ]; then obnam verify -r $SERVER_DIRECTORY/backup/${2} --encrypt-with ${ADMIN_BACKUP_KEY_ID} ${1}
if [[ ${1} == "/root/temp"* || ${1} == *"tempbackup" ]]; then if [ ! "$?" = "0" ]; then
shred -zu /root/temp${2}/* if [[ ${1} == "/root/temp"* || ${1} == *"tempbackup" ]]; then
rm -rf /root/temp${2} 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 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 fi
obnam forget --keep=30d -r $SERVER_DIRECTORY/backup/${2} --encrypt-with ${ADMIN_BACKUP_KEY_ID} obnam forget --keep=30d -r $SERVER_DIRECTORY/backup/${2} --encrypt-with ${ADMIN_BACKUP_KEY_ID}
if [ ! "$?" = "0" ]; then if [ ! "$?" = "0" ]; then