hosts/scripts/mysql_backup.sh: fix error if saving database mysql ('--lock-tables=0) in case of mariadb.
This commit is contained in:
		| @@ -95,12 +95,6 @@ err_Log=${LOCK_DIR}/mysql.err.log | |||||||
| # -------------------- Variable --------------------- # | # -------------------- 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 | if [ $srcHost != "localhost" ] || $_via_ssh_tunnel ;then | ||||||
|    mysql=`$ssh ${ssh_user}@$srcHost which mysql` |    mysql=`$ssh ${ssh_user}@$srcHost which mysql` | ||||||
| @@ -152,6 +146,12 @@ else | |||||||
| 	MYSQL_DISTRIBUTION="MySQL" | 	MYSQL_DISTRIBUTION="MySQL" | ||||||
| fi | 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 | if [ ! -d $_backupDestArchiveDir ]; then | ||||||
| @@ -967,6 +967,15 @@ if $ARCHIVE ;then | |||||||
|  |  | ||||||
|          mysqldump_flags="--no-data --no-create-info --routines" |          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.." |          info_msg="save functions of database $i.." | ||||||
|          echononl "\t$info_msg" |          echononl "\t$info_msg" | ||||||
|          if [ $srcHost != "localhost" ] || $_via_ssh_tunnel ;then |          if [ $srcHost != "localhost" ] || $_via_ssh_tunnel ;then | ||||||
| @@ -1103,6 +1112,15 @@ if $ARCHIVE ;then | |||||||
|          mysqldump_flags="$mysqldump_flags --events" |          mysqldump_flags="$mysqldump_flags --events" | ||||||
|       fi |       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.." |       info_msg="save database $i.." | ||||||
|       echononl "\t$info_msg" |       echononl "\t$info_msg" | ||||||
|       if [ $srcHost != "localhost" ] || $_via_ssh_tunnel ;then |       if [ $srcHost != "localhost" ] || $_via_ssh_tunnel ;then | ||||||
|   | |||||||
							
								
								
									
										1
									
								
								rcopy.sh
									
									
									
									
									
								
							
							
						
						
									
										1
									
								
								rcopy.sh
									
									
									
									
									
								
							| @@ -237,7 +237,6 @@ fi | |||||||
| ## - | ## - | ||||||
| if $manual ; then | if $manual ; then | ||||||
|    host_scripts="${hosts_base_dir}/localhost.sh" |    host_scripts="${hosts_base_dir}/localhost.sh" | ||||||
|    host_scripts="${hosts_base_dir}/gw-km.anw-km.netz.sh" |  | ||||||
| else | else | ||||||
|    host_scripts=`$find  $hosts_base_dir -maxdepth 1 -type f -perm -700 | $sort` |    host_scripts=`$find  $hosts_base_dir -maxdepth 1 -type f -perm -700 | $sort` | ||||||
| fi | fi | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user