diff --git a/src/freedombone-utils-backup b/src/freedombone-utils-backup index 9db2af31..7c53eef0 100755 --- a/src/freedombone-utils-backup +++ b/src/freedombone-utils-backup @@ -264,6 +264,18 @@ function set_obnam_client_name { function backup_directory_to_usb_duplicity { create_backups_temp_directory echo "$BACKUP_DUMMY_PASSWORD" | duplicity full --tempdir $BACKUP_TEMP_DIRECTORY --encrypt-key $MY_BACKUP_KEY_ID --full-if-older-than 4W --exclude-other-filesystems ${1} file://$USB_MOUNT/backup/${2} + if [ ! "$?" = "0" ]; then + umount $USB_MOUNT + rm -rf $USB_MOUNT + if [[ ${1} == "/root/temp"* || ${1} == *"tempbackup" ]]; then + shred -zu ${1}/* + rm -rf ${1} + fi + function_check restart_site + restart_site + remove_backups_temp_directory + exit 8352925 + fi if [[ $ENABLE_BACKUP_VERIFICATION == "yes" ]]; then echo "$BACKUP_DUMMY_PASSWORD" | duplicity verify --tempdir $BACKUP_TEMP_DIRECTORY --encrypt-key $MY_BACKUP_KEY_ID --full-if-older-than 4W --exclude-other-filesystems ${1} file://$USB_MOUNT/backup/${2} if [ ! "$?" = "0" ]; then @@ -424,6 +436,16 @@ function set_user_permissions { function backup_directory_to_friend_duplicity { create_backups_temp_directory echo "$BACKUP_DUMMY_PASSWORD" | duplicity full --tempdir $BACKUP_TEMP_DIRECTORY --ssh-askpass --encrypt-key ${ADMIN_BACKUP_KEY_ID} --full-if-older-than 4W --exclude-other-filesystems ${1} $SERVER_DIRECTORY/backup/${2} + if [ ! "$?" = "0" ]; then + if [[ ${1} == "/root/temp"* || ${1} == *"tempbackup" ]]; then + shred -zu ${1}/* + rm -rf ${1} + fi + function_check restart_site + restart_site + remove_backups_temp_directory + exit 5293526 + fi if [[ $ENABLE_BACKUP_VERIFICATION == "yes" ]]; then echo "$BACKUP_DUMMY_PASSWORD" | duplicity verify --tempdir $BACKUP_TEMP_DIRECTORY --ssh-askpass --encrypt-key ${ADMIN_BACKUP_KEY_ID} --full-if-older-than 4W --exclude-other-filesystems ${1} $SERVER_DIRECTORY/backup/${2} if [ ! "$?" = "0" ]; then