games_app/deploy/gitea-stack/cleanup-oneshots.sh
Your Name e802ee23d5
Some checks failed
CI / test-and-build (push) Failing after 33s
Harden tloto-deploy and document Gitea CI/CD runbook
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-17 20:07:47 +02:00

32 lines
814 B
Bash

#!/usr/bin/env bash
# Archive one-shot bootstrap/diag scripts from ~ after backup. Keeps credentials and stacks.
set -euo pipefail
BACKUP="$HOME/backup-oneshots-$(date -u +%Y%m%dT%H%M%SZ).tar.gz"
cd "$HOME"
FILES=(
allow-docker-pg.sh
diag-pg-docker2.sh
fix-pg-for-docker.sh
fix-pg-docker.sh
remote-bootstrap-env-db.sh
remote-bootstrap-phase-a.sh
remote-migrate-and-up.sh
remote-reset-db-migrate-up.sh
tighten-pg-listen.sh
verify-harden.sh
)
EXIST=()
for f in "${FILES[@]}"; do
[[ -f "$f" ]] && EXIST+=("$f")
done
if [[ ${#EXIST[@]} -eq 0 ]]; then
echo "Nothing to clean"
exit 0
fi
tar -czf "$BACKUP" "${EXIST[@]}"
mkdir -p "$HOME/archive-oneshots"
mv "${EXIST[@]}" "$HOME/archive-oneshots/"
echo "Archived to $BACKUP and moved into ~/archive-oneshots/"
ls -la "$BACKUP"
echo "CLEANUP_OK"