mirror of
https://github.com/kevinveenbirkenbach/docker-volume-backup.git
synced 2024-12-11 17:15:37 +01:00
Implemented stop on first error
This commit is contained in:
parent
9d8e80f793
commit
0077efa63c
@ -29,7 +29,7 @@ if [ ! -z "$database_type" ]; then
|
|||||||
if [ -n "$database_container" ] && [ -n "$database_password" ] && [ -n "$database_name" ]; then
|
if [ -n "$database_container" ] && [ -n "$database_password" ] && [ -n "$database_name" ]; then
|
||||||
echo "Recover PostgreSQL dump"
|
echo "Recover PostgreSQL dump"
|
||||||
export PGPASSWORD="$database_password"
|
export PGPASSWORD="$database_password"
|
||||||
cat "$backup_sql" | docker exec -i "$database_container" psql -U "$database_user" -d "$database_name"
|
cat "$backup_sql" | docker exec -i "$database_container" psql -v ON_ERROR_STOP=1 -U "$database_user" -d "$database_name"
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo "ERROR: Failed to recover PostgreSQL dump"
|
echo "ERROR: Failed to recover PostgreSQL dump"
|
||||||
exit 1
|
exit 1
|
||||||
|
Loading…
Reference in New Issue
Block a user