Skip to content

Instantly share code, notes, and snippets.

@aerodomigue
Created May 18, 2026 18:07
Show Gist options
  • Select an option

  • Save aerodomigue/2cfbb6b8c37274c6d0d722817e96f631 to your computer and use it in GitHub Desktop.

Select an option

Save aerodomigue/2cfbb6b8c37274c6d0d722817e96f631 to your computer and use it in GitHub Desktop.
Gracefully shutdown a single Proxmox VE node. Stops HA services (pve-ha-lrm, pve-ha-crm) before powering off to avoid HA fencing or VM recovery attempts. Supports --dry-run.
#!/bin/bash
# cluster-shutdown - Properly shut down the local node by stopping the HA before
# Usage: cluster-shutdown [--dry-run]
DRY_RUN=false
[ "$1" = "--dry-run" ] && DRY_RUN=true
LOCAL=$(hostname)
echo "=== cluster-shutdown (single node) ==="
echo "Local node: $LOCAL"
if $DRY_RUN; then
echo "[DRY-RUN] Would stop pve-ha-lrm pve-ha-crm on $LOCAL"
echo "[DRY-RUN] Would shutdown $LOCAL"
echo "=== Dry run complete, no action taken ==="
exit 0
fi
echo "Stopping HA on $LOCAL..."
systemctl stop pve-ha-lrm pve-ha-crm
echo "Shutting down $LOCAL..."
/sbin/shutdown -h now
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment