diff --git a/hosts/scripts/mysql_backup.sh b/hosts/scripts/mysql_backup.sh index 804f44e..5d0eaaf 100755 --- a/hosts/scripts/mysql_backup.sh +++ b/hosts/scripts/mysql_backup.sh @@ -95,12 +95,6 @@ err_Log=${LOCK_DIR}/mysql.err.log # -------------------- Variable --------------------- # # -if [[ -n ${mysql_version} ]]; then - _backupDestArchiveDir="${script_backup_dir}/MySQL-${mysql_version}" -else - _backupDestArchiveDir="${script_backup_dir}/MySQL" -fi - if [ $srcHost != "localhost" ] || $_via_ssh_tunnel ;then mysql=`$ssh ${ssh_user}@$srcHost which mysql` @@ -152,6 +146,12 @@ else MYSQL_DISTRIBUTION="MySQL" fi +if [[ -n ${mysql_version} ]]; then + _backupDestArchiveDir="${script_backup_dir}/${MYSQL_DISTRIBUTION}-${mysql_version}" +else + _backupDestArchiveDir="${script_backup_dir}/${MYSQL_DISTRIBUTION}" +fi + if [ ! -d $_backupDestArchiveDir ]; then @@ -967,6 +967,15 @@ if $ARCHIVE ;then mysqldump_flags="--no-data --no-create-info --routines" + if [ "$i" = "mysql" -a "$MYSQL_DISTRIBUTION" = "MariaDB" ]; then + # - prevent from error: + # - Error 1556: You can't use locks with log tables + # - + # - use '--lock-tables=0' + # - + mysqldump_flags="$mysqldump_flags --lock-tables=0" + fi + info_msg="save functions of database $i.." echononl "\t$info_msg" if [ $srcHost != "localhost" ] || $_via_ssh_tunnel ;then @@ -1103,6 +1112,15 @@ if $ARCHIVE ;then mysqldump_flags="$mysqldump_flags --events" fi + if [ "$i" = "mysql" -a "$MYSQL_DISTRIBUTION" = "MariaDB" ]; then + # - prevent from error: + # - Error 1556: You can't use locks with log tables + # - + # - use '--lock-tables=0' + # - + mysqldump_flags="$mysqldump_flags --events --lock-tables=0" + fi + info_msg="save database $i.." echononl "\t$info_msg" if [ $srcHost != "localhost" ] || $_via_ssh_tunnel ;then diff --git a/rcopy.sh b/rcopy.sh index f6959c5..7f8b870 100755 --- a/rcopy.sh +++ b/rcopy.sh @@ -237,7 +237,6 @@ fi ## - if $manual ; then host_scripts="${hosts_base_dir}/localhost.sh" - host_scripts="${hosts_base_dir}/gw-km.anw-km.netz.sh" else host_scripts=`$find $hosts_base_dir -maxdepth 1 -type f -perm -700 | $sort` fi