30 lines
708 B
Bash
30 lines
708 B
Bash
#!/usr/bin/env bash
|
|
# Stops and removes the deploy-watch systemd service installed by
|
|
# install-deploy-watch.sh.
|
|
#
|
|
# Usage: sudo ./scripts/uninstall-deploy-watch.sh
|
|
|
|
set -euo pipefail
|
|
|
|
if [ "$(id -u)" -ne 0 ]; then
|
|
echo "Run this with sudo (modifies /etc/systemd/system)." >&2
|
|
exit 1
|
|
fi
|
|
|
|
UNIT_NAME="deploy-watch-hwilliams-dev.service"
|
|
UNIT_DEST="/etc/systemd/system/$UNIT_NAME"
|
|
|
|
if systemctl list-unit-files | grep -q "^$UNIT_NAME"; then
|
|
systemctl disable --now "$UNIT_NAME"
|
|
else
|
|
echo "$UNIT_NAME is not installed; nothing to disable."
|
|
fi
|
|
|
|
if [ -f "$UNIT_DEST" ]; then
|
|
rm "$UNIT_DEST"
|
|
systemctl daemon-reload
|
|
echo "Removed $UNIT_DEST."
|
|
else
|
|
echo "$UNIT_DEST not found; nothing to remove."
|
|
fi
|