parent
054c149d12
commit
5ab5006651
@ -0,0 +1,21 @@ |
|||||||
|
# Immediatly exit on command failure (e) |
||||||
|
# and quit on unset variables (u) |
||||||
|
set -ue |
||||||
|
|
||||||
|
export BACKUP_REPO=ssh://cttuebak/media/borg/cttue/pad |
||||||
|
export BACKUP_NAME_DB="db_$(date -u +'%Y-%m-%dT%H:%M%Z')" |
||||||
|
export BACKUP_NAME_UPLOADS="uploads_$(date -u +'%Y-%m-%dT%H:%M%Z')" |
||||||
|
export BORG_PASSPHRASE=$(cat "$(dirname $0)/borg_passphrase.txt") |
||||||
|
|
||||||
|
# Dump the database into borg create |
||||||
|
echo "Starting Backup of Pad Database..." |
||||||
|
docker exec pad_database_1 pg_dump hedgedoc -U hedgedoc | |
||||||
|
/usr/bin/borg create --compression zstd --stats ${BACKUP_REPO}::${BACKUP_NAME_DB} - |
||||||
|
|
||||||
|
echo "Starting Backup of Pad Uploaded Files..." |
||||||
|
/usr/bin/borg create --compression zstd --stats ${BACKUP_REPO}::${BACKUP_NAME_UPLOADS} /srv/docker-containers/pad/uploads |
||||||
|
|
||||||
|
echo "Backup done. Pruning backup-repo..." |
||||||
|
/usr/bin/borg prune -v --list --keep-daily=7 --keep-weekly=7 --keep-monthly=10 --keep-yearly=5 ${BACKUP_REPO} |
||||||
|
|
||||||
|
echo "Done" |
Loading…
Reference in new issue