Skip to content

Repository files, collaboration, releases and project activity.

ARCHFORGE HISTORY

Blame · scripts/rollback.sh

Branch main · the Commit author is not necessarily a verified ArchForge account.

e59b7f7cc6archadmin2026-10-111 #!/usr/bin/env bash
e59b7f7cc6archadmin2026-10-112 set -Eeuo pipefail
e59b7f7cc6archadmin2026-10-113 [[ $EUID -eq 0 ]] || { echo 'Use sudo.' >&2;exit 1; }
e59b7f7cc6archadmin2026-10-114 BASE=/opt/archforge-status
e59b7f7cc6archadmin2026-10-115 [[ -f "$BASE/previous-release" ]] || { echo 'No previous release snapshot.' >&2;exit 1; }
e59b7f7cc6archadmin2026-10-116 SNAP=$(cat "$BASE/previous-release")
e59b7f7cc6archadmin2026-10-117 [[ "$SNAP" == "$BASE"/releases/release-* && -d "$SNAP" ]] || { echo 'Invalid rollback path.' >&2;exit 1; }
e59b7f7cc6archadmin2026-10-118 read -rp 'Roll back application code (database remains unchanged)? Type ROLLBACK: ' ANSWER
e59b7f7cc6archadmin2026-10-119 [[ "$ANSWER" == ROLLBACK ]] || exit 1
e59b7f7cc6archadmin2026-10-1110 systemctl stop archforge-status
e59b7f7cc6archadmin2026-10-1111 mv "$BASE/app" "$BASE/releases/undone-$(date -u +%Y%m%d-%H%M%S)"
e59b7f7cc6archadmin2026-10-1112 mv "$SNAP" "$BASE/app"
e59b7f7cc6archadmin2026-10-1113 rm -f "$BASE/previous-release"
e59b7f7cc6archadmin2026-10-1114 systemctl start archforge-status
e59b7f7cc6archadmin2026-10-1115 echo 'Rollback completed. If schema changes are incompatible, use restore.sh with a matching backup.'