From 728f4f3e71527e6cd7642de61787e9793a459388 Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Wed, 21 Mar 2018 00:11:11 +0100 Subject: [PATCH] [metactl.post-start] restore without specifying database [metactl.pre-stop] backup with --flush-privileges --- metactl/post-start.sh | 2 +- metactl/pre-stop.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/metactl/post-start.sh b/metactl/post-start.sh index e75baa4..f1fa2d4 100644 --- a/metactl/post-start.sh +++ b/metactl/post-start.sh @@ -46,7 +46,7 @@ if [ "$DUMP_FILE_EXISTS" = "0" ]; then # Restore mariadb database echo -ne " * Restore database.........."; - cat $MARIADB_DUMP | docker exec -i $MARIADB_SERVICE mysql -uroot -p$MARIADB_ROOT_PASSWORD $MARIADB_DATABASE_NAME 2>/dev/null && echo "restored" || echo "failed"; + cat $MARIADB_DUMP | docker exec -i $MARIADB_SERVICE mysql -uroot -p$MARIADB_ROOT_PASSWORD 2>/dev/null && echo "restored" || echo "failed"; else diff --git a/metactl/pre-stop.sh b/metactl/pre-stop.sh index 0f539b2..205a90d 100644 --- a/metactl/pre-stop.sh +++ b/metactl/pre-stop.sh @@ -15,5 +15,5 @@ test ! -d $ROOT/persistent && mkdir -p $ROOT/persistent; # 2. Backup database echo -ne " * Backup database..........."; -docker exec $MARIADB_SERVICE mysqldump --all-databases -uroot -p$MARIADB_ROOT_PASSWORD > $MARIADB_DUMP; +docker exec $MARIADB_SERVICE mysqldump --all-databases --flush-privileges -uroot -p$MARIADB_ROOT_PASSWORD > $MARIADB_DUMP; test "$?" = "0" && echo "done" || (echo "failed"; exit 1); \ No newline at end of file