Fixed error handle on backuptool
This commit is contained in:
parent
8ef5dbba82
commit
3460be4852
@ -1,4 +1,4 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash -x
|
||||||
#
|
#
|
||||||
# Federated Backup / Restore Tool to B2 Backblaze
|
# Federated Backup / Restore Tool to B2 Backblaze
|
||||||
. /federated/lib/functions.sh
|
. /federated/lib/functions.sh
|
||||||
@ -65,7 +65,8 @@ backupservice() {
|
|||||||
rm /federated/apps/wordpress/dump_$SERVICE.sql.gz
|
rm /federated/apps/wordpress/dump_$SERVICE.sql.gz
|
||||||
else
|
else
|
||||||
# For all other services, If the postgresql database exists for that service then dump it
|
# For all other services, If the postgresql database exists for that service then dump it
|
||||||
if [ ! "`docker exec -it postgresql psql -U $SERVICE -c '\q' &>/dev/null`" ]; then
|
docker exec -it postgresql psql -U $SERVICE -c '\q' &>/dev/null
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
docker exec postgresql /bin/bash -c "pg_dump $SERVICE -c -U postgres | gzip -9 > /docker-entrypoint-initdb.d/dump_$SERVICE.sql.gz"
|
docker exec postgresql /bin/bash -c "pg_dump $SERVICE -c -U postgres | gzip -9 > /docker-entrypoint-initdb.d/dump_$SERVICE.sql.gz"
|
||||||
mv /federated/apps/postgresql/data/docker-entrypoint-initdb.d/dump_$SERVICE.sql.gz /federated/apps/$SERVICE/
|
mv /federated/apps/postgresql/data/docker-entrypoint-initdb.d/dump_$SERVICE.sql.gz /federated/apps/$SERVICE/
|
||||||
fi
|
fi
|
||||||
@ -103,7 +104,8 @@ backupserviceall() {
|
|||||||
PASSPHRASE=$GPG_PASSPHRASE duplicity /federated/apps/$i b2://$B2_APPLICATION_KEY_ID:$B2_APPLICATION_KEY@$UUID/$i/
|
PASSPHRASE=$GPG_PASSPHRASE duplicity /federated/apps/$i b2://$B2_APPLICATION_KEY_ID:$B2_APPLICATION_KEY@$UUID/$i/
|
||||||
rm /federated/apps/wordpress/dump_$i.sql.gz
|
rm /federated/apps/wordpress/dump_$i.sql.gz
|
||||||
else
|
else
|
||||||
if [ ! "`docker exec -it postgresql psql -U $i -c '\q' &>/dev/null`" ]; then
|
docker exec -it postgresql psql -U $i -c '\q' &>/dev/null
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
docker exec postgresql /bin/bash -c "pg_dump $i -c -U postgres | gzip -9 > /docker-entrypoint-initdb.d/dump_$i.sql.gz"
|
docker exec postgresql /bin/bash -c "pg_dump $i -c -U postgres | gzip -9 > /docker-entrypoint-initdb.d/dump_$i.sql.gz"
|
||||||
mv /federated/apps/postgresql/data/docker-entrypoint-initdb.d/dump_$i.sql.gz /federated/apps/$i/
|
mv /federated/apps/postgresql/data/docker-entrypoint-initdb.d/dump_$i.sql.gz /federated/apps/$i/
|
||||||
fi
|
fi
|
||||||
|
Loading…
x
Reference in New Issue
Block a user