mirror of
https://github.com/fradelg/docker-mysql-cron-backup.git
synced 2025-01-18 16:22:33 +01:00
Quotes on SQL var was missing.
This commit is contained in:
parent
7c8f51eac3
commit
41ea03511f
1 changed files with 2 additions and 2 deletions
|
@ -13,13 +13,13 @@ SQL=$(gunzip -c "$1")
|
|||
DB_NAME=${MYSQL_DATABASE:-${MYSQL_DB}}
|
||||
if [ -z "${DB_NAME}"]
|
||||
then
|
||||
DB_NAME=$(echo $SQL | grep -oE '(Database: (\w*))' | cut -d ' ' -f 2)
|
||||
DB_NAME=$(echo "$SQL" | grep -oE '(Database: (\w*))' | cut -d ' ' -f 2)
|
||||
fi
|
||||
[ -z "${DB_NAME}" ] && { echo "=> database name cannot be found" && exit 1; }
|
||||
|
||||
echo "=> Restore database $DB_NAME from $1"
|
||||
|
||||
if echo $SQL | mysql -h "$MYSQL_HOST" -P "$MYSQL_PORT" -u "$MYSQL_USER" -p"$MYSQL_PASS" "$DB_NAME"
|
||||
if echo "$SQL" | mysql -h "$MYSQL_HOST" -P "$MYSQL_PORT" -u "$MYSQL_USER" -p"$MYSQL_PASS" "$DB_NAME"
|
||||
then
|
||||
echo "=> Restore succeeded"
|
||||
else
|
||||
|
|
Loading…
Reference in a new issue