hy-app-monitor/scripts/uninstall_systemd.sh

17 lines
426 B
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
SCRIPT_DIR="$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)"
# shellcheck disable=SC1091
source "$SCRIPT_DIR/common.sh"
UNIT_DST="/etc/systemd/system/$SYSTEMD_SERVICE_NAME"
if command -v systemctl >/dev/null 2>&1; then
systemctl disable --now "$SYSTEMD_SERVICE_NAME" >/dev/null 2>&1 || true
systemctl daemon-reload || true
fi
rm -f "$UNIT_DST"
echo "systemd unit removed: $UNIT_DST"