Fix pipefail position

This commit is contained in:
Stelage 2021-05-09 17:57:18 +02:00
parent 1302281333
commit 7c8f51eac3

View file

@ -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