Files
hcrb/deploy/backup.sh
T
2026-10-10 14:16:09 +02:00

12 lines
451 B
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/bash
# Tägliche Sicherung von data/ (Mitglieder, Termine, Benutzer) – behält die letzten 30 Tage.
# Als Cronjob einrichten (sudo crontab -e):
# 30 3 * * * <projektordner>/deploy/backup.sh
set -euo pipefail
PROJECT="$(dirname "$(readlink -f "$0")")/.."
DEST=/var/backups/hcrb
mkdir -p "$DEST"
tar -czf "$DEST/hcrb-$(date +%F).tar.gz" -C "$PROJECT" data
chmod 600 "$DEST"/hcrb-*.tar.gz
find "$DEST" -name 'hcrb-*.tar.gz' -mtime +30 -delete