#!/usr/bin/env bash # Trigger server-backup.service ad-hoc. Refuses if a run is already active # (the script itself also flock's, but checking here gives a friendlier error). set -uo pipefail UNIT=server-backup.service active=$(systemctl is-active "$UNIT" 2>/dev/null || true) if [ "$active" = "active" ] || [ "$active" = "activating" ]; then echo "ERROR: $UNIT is already $active — refusing to trigger." >&2 exit 75 fi # Use --no-block so we return immediately; the dashboard will poll via # read-status.sh and tail the log to follow progress. systemctl start --no-block "$UNIT" echo "Triggered $UNIT. Follow with: journalctl -u $UNIT -f"