#!/bin/bash # https://mariadb.com/kb/en/mariabackup/ set -e myDir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" . "$myDir/config.sh" todayDir="$(date +%Y-%m-%d)" backupName="${todayDir}_$(date +"%H-%M")_full" backupFile="$backupDir/$backupName.gz" if [ -d "$backupDir" ]; then rm -rf "$backupDir/"* fi ulimit -n 8192 mariabackup \ --defaults-extra-file="$myDir/my.cnf" \ --backup \ --extra-lsndir="$backupDir/$backupName" \ --history="$todayDir" \ 2>> "$logFile" \ | gzip \ > "$backupFile" if [ $? != "0" ]; then echo "An error ocurred during backup, please take a look at log file: $logFile" exit 1 fi