Add globs to borg prune to keep archives of db AND data

main
Marco von Rosenberg 2 years ago
parent 2c9b4b75f2
commit ec331c3d2a
  1. 7
      backups/gitea.sh
  2. 7
      backups/matrix.sh
  3. 7
      backups/nextcloud.sh
  4. 7
      backups/pad.sh

@ -12,10 +12,13 @@ echo "Starting Backup of Gitea Database..."
docker exec gitea_db_1 pg_dump gitea -U gitea | docker exec gitea_db_1 pg_dump gitea -U gitea |
/usr/bin/borg create --compression zstd --stats ${BACKUP_REPO}::${BACKUP_NAME_DB} - /usr/bin/borg create --compression zstd --stats ${BACKUP_REPO}::${BACKUP_NAME_DB} -
echo "Backup done. Pruning Gitea Database..."
/usr/bin/borg prune -v --list --keep-daily=7 --keep-weekly=7 --keep-monthly=10 --keep-yearly=5 -a "db_*" ${BACKUP_REPO}
echo "Starting Backup of Gitea Data..." echo "Starting Backup of Gitea Data..."
/usr/bin/borg create --compression zstd --stats ${BACKUP_REPO}::${BACKUP_NAME_DATA} /srv/docker-containers/gitea/gitea-data /usr/bin/borg create --compression zstd --stats ${BACKUP_REPO}::${BACKUP_NAME_DATA} /srv/docker-containers/gitea/gitea-data
echo "Backup done. Pruning backup-repo..." echo "Backup done. Pruning Gitea Data..."
/usr/bin/borg prune -v --list --keep-daily=7 --keep-weekly=7 --keep-monthly=10 --keep-yearly=5 ${BACKUP_REPO} /usr/bin/borg prune -v --list --keep-daily=7 --keep-weekly=7 --keep-monthly=10 --keep-yearly=5 -a "data_*" ${BACKUP_REPO}
echo "Done" echo "Done"

@ -12,10 +12,13 @@ echo "Starting Backup of Matrix / Synapse Database..."
docker exec matrix-postgres pg_dump synapse -U synapse | docker exec matrix-postgres pg_dump synapse -U synapse |
/usr/bin/borg create --compression zstd --stats ${BACKUP_REPO}::${BACKUP_NAME_DB} - /usr/bin/borg create --compression zstd --stats ${BACKUP_REPO}::${BACKUP_NAME_DB} -
echo "Backup done. Pruning Matrix / Synapse Database..."
/usr/bin/borg prune -v --list --keep-daily=7 --keep-weekly=7 --keep-monthly=10 --keep-yearly=5 -a "db_*" ${BACKUP_REPO}
echo "Starting Backup of Matrix / Synapse Storage..." echo "Starting Backup of Matrix / Synapse Storage..."
/usr/bin/borg create --compression zstd --stats ${BACKUP_REPO}::${BACKUP_NAME_DATA} /matrix/synapse/storage /usr/bin/borg create --compression zstd --stats ${BACKUP_REPO}::${BACKUP_NAME_DATA} /matrix/synapse/storage
echo "Backup done. Pruning backup-repo..." echo "Backup done. Pruning Matrix / Synapse Storage..."
/usr/bin/borg prune -v --list --keep-daily=7 --keep-weekly=7 --keep-monthly=10 --keep-yearly=5 ${BACKUP_REPO} /usr/bin/borg prune -v --list --keep-daily=7 --keep-weekly=7 --keep-monthly=10 --keep-yearly=5 -a "synapse-storage_*" ${BACKUP_REPO}
echo "Done" echo "Done"

@ -12,10 +12,13 @@ echo "Starting Backup of Nextcloud Database..."
docker exec nextcloud_nc_db_1 mysqldump -u nextcloud -pnextcloud --lock-tables --databases nextcloud | docker exec nextcloud_nc_db_1 mysqldump -u nextcloud -pnextcloud --lock-tables --databases nextcloud |
/usr/bin/borg create --compression zstd --stats ${BACKUP_REPO}::${BACKUP_NAME_DB} - /usr/bin/borg create --compression zstd --stats ${BACKUP_REPO}::${BACKUP_NAME_DB} -
echo "Backup done. Pruning Nextcloud Database..."
/usr/bin/borg prune -v --list --keep-daily=7 --keep-weekly=7 --keep-monthly=10 --keep-yearly=5 -a "db_*" ${BACKUP_REPO}
echo "Starting Backup of Nextcloud Uploaded Files..." echo "Starting Backup of Nextcloud Uploaded Files..."
/usr/bin/borg create --compression zstd --stats ${BACKUP_REPO}::${BACKUP_NAME_DATA} /srv/docker-containers/nextcloud/nextcloud-data /usr/bin/borg create --compression zstd --stats ${BACKUP_REPO}::${BACKUP_NAME_DATA} /srv/docker-containers/nextcloud/nextcloud-data
echo "Backup done. Pruning backup-repo..." echo "Backup done. Pruning Nextcloud Uploaded Files..."
/usr/bin/borg prune -v --list --keep-daily=7 --keep-weekly=7 --keep-monthly=10 --keep-yearly=5 ${BACKUP_REPO} /usr/bin/borg prune -v --list --keep-daily=7 --keep-weekly=7 --keep-monthly=10 --keep-yearly=5 -a "data_*" ${BACKUP_REPO}
echo "Done" echo "Done"

@ -12,10 +12,13 @@ echo "Starting Backup of Pad Database..."
docker exec pad_database_1 pg_dump hedgedoc -U hedgedoc | docker exec pad_database_1 pg_dump hedgedoc -U hedgedoc |
/usr/bin/borg create --compression zstd --stats ${BACKUP_REPO}::${BACKUP_NAME_DB} - /usr/bin/borg create --compression zstd --stats ${BACKUP_REPO}::${BACKUP_NAME_DB} -
echo "Backup done. Pad Database..."
/usr/bin/borg prune -v --list --keep-daily=7 --keep-weekly=7 --keep-monthly=10 --keep-yearly=5 -a "db_*" ${BACKUP_REPO}
echo "Starting Backup of Pad Uploaded Files..." echo "Starting Backup of Pad Uploaded Files..."
/usr/bin/borg create --compression zstd --stats ${BACKUP_REPO}::${BACKUP_NAME_UPLOADS} /srv/docker-containers/pad/uploads /usr/bin/borg create --compression zstd --stats ${BACKUP_REPO}::${BACKUP_NAME_UPLOADS} /srv/docker-containers/pad/uploads
echo "Backup done. Pruning backup-repo..." echo "Backup done. Pruning Pad Uploaded Files..."
/usr/bin/borg prune -v --list --keep-daily=7 --keep-weekly=7 --keep-monthly=10 --keep-yearly=5 ${BACKUP_REPO} /usr/bin/borg prune -v --list --keep-daily=7 --keep-weekly=7 --keep-monthly=10 --keep-yearly=5 -a "uploads_*" ${BACKUP_REPO}
echo "Done" echo "Done"

Loading…
Cancel
Save