From 0bb44485c18aa6eaf6409b31c9b623f0c825052c Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 30 Jul 2026 16:21:30 +0200 Subject: [PATCH] backup: naechtlicher gitea dump mit Ein-Dump-Rotation Cron (rantanplan, 03:17): gitea dump -> /opt/backup, nur der neueste Dump bleibt auf dem Host -- 38G-Platte traegt nicht mehr. Aeltere Staende off-host ziehen (siehe README/Skriptkopf). Co-Authored-By: Claude Fable 5 --- backup/gitea-backup.sh | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100755 backup/gitea-backup.sh diff --git a/backup/gitea-backup.sh b/backup/gitea-backup.sh new file mode 100755 index 0000000..2abb717 --- /dev/null +++ b/backup/gitea-backup.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# Naechtliches Gitea-Backup (Cron des Users rantanplan, kein sudo noetig). +# Rotation: Es bleibt NUR der neueste Dump auf dem Host -- die Platte (38G) +# traegt nicht mehr, aeltere Staende gehoeren off-host: +# scp -P 2248 rantanplan@188.245.193.243:/opt/backup/gitea-dump-.zip . +set -eu + +BACKUP_DIR=/opt/backup +CONTAINER=thread-net-git-gitea-1 +TARGET="$BACKUP_DIR/gitea-dump-$(date +%F).zip" + +docker exec "$CONTAINER" rm -f /tmp/gitea-dump.zip +docker exec -u git -w /tmp "$CONTAINER" gitea dump -c /data/gitea/conf/app.ini -f /tmp/gitea-dump.zip +docker cp -q "$CONTAINER:/tmp/gitea-dump.zip" "$TARGET.tmp" +docker exec "$CONTAINER" rm -f /tmp/gitea-dump.zip +mv "$TARGET.tmp" "$TARGET" + +find "$BACKUP_DIR" -maxdepth 1 -name 'gitea-dump-*.zip' ! -name "$(basename "$TARGET")" -delete + +echo "$(date -Is) backup ok: $TARGET ($(du -h "$TARGET" | cut -f1))"