From 0b8ac4f4d167e3e461f3accd4fd0e2d6e0174388 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sun, 11 Jun 2017 10:56:46 +0100 Subject: [PATCH] Keep database running during backup and restore --- src/freedombone-backup-local | 1 + src/freedombone-backup-remote | 1 + src/freedombone-restore-local | 1 + 3 files changed, 3 insertions(+) diff --git a/src/freedombone-backup-local b/src/freedombone-backup-local index 983ba7ea..b358084a 100755 --- a/src/freedombone-backup-local +++ b/src/freedombone-backup-local @@ -305,6 +305,7 @@ function backup_mariadb { if [ ! -d $temp_backup_dir ]; then mkdir $temp_backup_dir fi + keep_database_running mysqldump --lock-tables --password="$DATABASE_PASSWORD" mysql user > $temp_backup_dir/mysql.sql if [ ! -s $temp_backup_dir/mysql.sql ]; then echo $"Unable to backup mysql settings" diff --git a/src/freedombone-backup-remote b/src/freedombone-backup-remote index 97b9712c..3e0ac983 100755 --- a/src/freedombone-backup-remote +++ b/src/freedombone-backup-remote @@ -305,6 +305,7 @@ function backup_mariadb { if [ ! -d $temp_backup_dir ]; then mkdir $temp_backup_dir fi + keep_database_running mysqldump --password=$DATABASE_PASSWORD mysql user > $temp_backup_dir/mysql.sql if [ ! -s $temp_backup_dir/mysql.sql ]; then echo $"Unable to backup MariaDB settings" diff --git a/src/freedombone-restore-local b/src/freedombone-restore-local index 68689b61..fef34d20 100755 --- a/src/freedombone-restore-local +++ b/src/freedombone-restore-local @@ -205,6 +205,7 @@ function restore_mariadb { if [ -d $USB_MOUNT/backup/mariadb ]; then echo $"Restoring mysql settings" + keep_database_running temp_restore_dir=/root/tempmariadb restore_directory_from_usb $temp_restore_dir mariadb echo $'Obtaining MariaDB password'