#!/usr/bin/env bash set -euo pipefail # Self-heal recovery for a stale/dead PIA WireGuard tunnel — the one-line action to run # when the VpnTunnelDown alert fires. Registers a fresh peer, then recreates gluetun so # it loads the new wg0.conf, and reconnects SAB/Transmission through the restored netns. cd "$(dirname "$0")/.." # -> ~/downloads echo "[regen-and-up] 1/3 registering a fresh PIA WG peer..." docker compose run --rm pia-wg-regen echo "[regen-and-up] 2/3 recreating gluetun with the new wg0.conf..." docker compose up -d --force-recreate --no-deps gluetun echo "[regen-and-up] 3/3 reconnecting dependents through the restored netns..." docker compose up -d --force-recreate sabnzbd transmission echo "[regen-and-up] done."