mirror of
https://github.com/fradelg/docker-mysql-cron-backup.git
synced 2024-11-01 08:31:45 +01:00
Fix pipefail position
This commit is contained in:
parent
1302281333
commit
7c8f51eac3
1 changed files with 2 additions and 3 deletions
|
@ -7,6 +7,8 @@ then
|
|||
echo "You must pass the path of the backup file to restore"
|
||||
fi
|
||||
|
||||
set -o pipefail
|
||||
|
||||
SQL=$(gunzip -c "$1")
|
||||
DB_NAME=${MYSQL_DATABASE:-${MYSQL_DB}}
|
||||
if [ -z "${DB_NAME}"]
|
||||
|
@ -15,10 +17,7 @@ then
|
|||
fi
|
||||
[ -z "${DB_NAME}" ] && { echo "=> database name cannot be found" && exit 1; }
|
||||
|
||||
|
||||
echo "=> Restore database $DB_NAME from $1"
|
||||
set -o pipefail
|
||||
|
||||
|
||||
if echo $SQL | mysql -h "$MYSQL_HOST" -P "$MYSQL_PORT" -u "$MYSQL_USER" -p"$MYSQL_PASS" "$DB_NAME"
|
||||
then
|
||||
|
|
Loading…
Reference in a new issue