todiadiyatmo/bash-backup-rotation-script

Incorrect harmless error when SQL_BACKUP_OPTION=0

Opened this issue · 0 comments

Using this option set:

LOCAL_BACKUP_OPTION=1
FTP_BACKUP_OPTION=0
SQL_BACKUP_OPTION=0
FILES_BACKUP_OPTION=7

Script will give incorrect error due to this code (it's not really optional, it's happening always):

if [ ! -f $TMP_DIR/backup.incoming/$backup_filename ]; then
echo "Daily backup failed! Please check for missing files." | mail -s "$EMAIL_SUBJECT_TAG Backup Failed" $MAIL
fi

One possible fix is to only check for back-up file name when SQL backup option is set to non-zero? We are using script for CouchDB backup so we used this for temporary fix:

if [ ! $PERFORM_SQL_BACKUP -eq 0 ]; then
if [ ! -f $TMP_DIR/backup.incoming/$backup_filename ]; then
echo "Daily backup failed! Please check for missing files." | mail -s "$EMAIL_SUBJECT_TAG Backup Failed" $MAIL
fi
fi