removed maintenance mode from backup and restore

This commit is contained in:
mattisderbock@gmail.com 2020-11-27 09:13:18 +01:00
parent 4b5e26b853
commit 34895b7372
2 changed files with 7 additions and 1 deletions

View file

@ -1,6 +1,8 @@
su -s /bin/bash -c 'php occ maintenance:mode --on' www-data
set -o pipefail set -o pipefail
# backup database dump # backup database dump
pg_dump -d $(cat ${POSTGRES_DB_FILE}) -h $POSTGRES_SERVICE -p $POSTGRES_PORT -U $(cat ${POSTGRES_USER_FILE}) --no-password --serializable-deferrable --clean --no-privileges | \ pg_dump -d $(cat ${POSTGRES_DB_FILE}) -h $POSTGRES_SERVICE -p $POSTGRES_PORT -U $(cat ${POSTGRES_USER_FILE}) --no-password --serializable-deferrable --clean --no-privileges | \
restic -r $RESTIC_REPOSITORY --verbose backup --stdin --tag DB_Backup restic -r $RESTIC_REPOSITORY --verbose backup --stdin --tag DB_Backup
# backup nextcloud filesystem # backup nextcloud filesystem
restic -r $RESTIC_REPOSITORY backup /var/backups/ --tag Nextcloud_Filesystem restic -r $RESTIC_REPOSITORY backup /var/backups/ --tag Nextcloud_Filesystem
su -s /bin/bash -c 'php occ maintenance:mode --off' www-data

View file

@ -1,4 +1,6 @@
# Restore Nextcloud Filesystem # Restore Nextcloud Filesystem
# turn on maintenance mode
su -s /bin/bash -c 'php occ maintenance:mode --on' www-data
# Reads restore snapshot_ID from first CLI Argument # Reads restore snapshot_ID from first CLI Argument
restic -r $RESTIC_REPOSITORY restore $1 --target / restic -r $RESTIC_REPOSITORY restore $1 --target /
@ -10,3 +12,5 @@ psql -d template1 -h $POSTGRES_SERVICE -p $POSTGRES_PORT -U $(cat ${POSTGRES_USE
restic -r $RESTIC_REPOSITORY restore $2 --target test-stdin-$2 restic -r $RESTIC_REPOSITORY restore $2 --target test-stdin-$2
# read folder and restore db entries # read folder and restore db entries
psql -d $(cat ${POSTGRES_DB_FILE}) -h $POSTGRES_SERVICE -p $POSTGRES_PORT -U $(cat ${POSTGRES_USER_FILE}) --no-password < test-stdin-$2 psql -d $(cat ${POSTGRES_DB_FILE}) -h $POSTGRES_SERVICE -p $POSTGRES_PORT -U $(cat ${POSTGRES_USER_FILE}) --no-password < test-stdin-$2
# turn off maintenance mode
su -s /bin/bash -c 'php occ maintenance:mode --off' www-data