message="There was an error trying to dump database $db, please fix this db. We stop there without backups."
echo $message
echo $message | /usr/bin/mail -s "error on backup of $db MariaDB database" admin
fi
message="$message \nThere was an error trying to dump database $db, please check for table errors in this db. Forcing a backup of the corrupted DB."
mysqldump --force --ignore-table=mysql.event --single-transaction --add-drop-table -QB "$db" -r /home/e-smith/db/mysql/"$db"-failed.dump || message="$message \nFailed to force backup of corrupted db $db as $db-failed.dump" >&2
if [ "$fixtables" = "enabled" ]; then
repair="failure"
message="$message \nTrying to auto-repair the db and do a backup after..."