fix distinguishing backup-types by different tags
This commit is contained in:
parent
7d759e4d68
commit
f4f629098e
3 changed files with 7 additions and 6 deletions
|
@ -4,7 +4,7 @@ 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/db backup --stdin
|
||||||
|
|
||||||
# backup nextcloud filesystem
|
# backup nextcloud filesystem
|
||||||
restic -r $RESTIC_REPOSITORY backup /var/backups/ --tag Nextcloud_Filesystem
|
restic -r $RESTIC_REPOSITORY/files backup /var/backups/
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
restic -r $RESTIC_REPOSITORY --verbose init
|
restic -r $RESTIC_REPOSITORY/db --verbose init
|
||||||
|
restic -r $RESTIC_REPOSITORY/files --verbose init
|
||||||
|
|
|
@ -4,13 +4,13 @@
|
||||||
# TODO: describe input params
|
# TODO: describe input params
|
||||||
|
|
||||||
# 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/files restore latest --target /var/backups/
|
||||||
|
|
||||||
# Delete DB
|
# Delete DB
|
||||||
psql -d template1 -h $POSTGRES_SERVICE -p $POSTGRES_PORT -U $(cat ${POSTGRES_USER_FILE}) --no-password -c "DROP DATABASE \"cloud\";"
|
psql -d template1 -h $POSTGRES_SERVICE -p $POSTGRES_PORT -U $(cat ${POSTGRES_USER_FILE}) --no-password -c "DROP DATABASE \"cloud\";"
|
||||||
# Create DB again
|
# Create DB again
|
||||||
psql -d template1 -h $POSTGRES_SERVICE -p $POSTGRES_PORT -U $(cat ${POSTGRES_USER_FILE}) --no-password -c "CREATE DATABASE \"cloud\";"
|
psql -d template1 -h $POSTGRES_SERVICE -p $POSTGRES_PORT -U $(cat ${POSTGRES_USER_FILE}) --no-password -c "CREATE DATABASE \"cloud\";"
|
||||||
# create folder from db backup
|
# create folder from db backup
|
||||||
restic -r $RESTIC_REPOSITORY restore $2 --target test-stdin-$2
|
restic -r $RESTIC_REPOSITORY/db restore latest --target test-stdin
|
||||||
# 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/stdin
|
psql -d $(cat ${POSTGRES_DB_FILE}) -h $POSTGRES_SERVICE -p $POSTGRES_PORT -U $(cat ${POSTGRES_USER_FILE}) --no-password < test-stdin/stdin
|
||||||
|
|
Loading…
Reference in a new issue