#!/bin/bash # Uninstall DaemonControl systemd service set -e echo "========================================" echo " DaemonControl Service Uninstallation" echo "========================================" echo # Check if running with sudo if [ "$EUID" -ne 0 ]; then echo "⚠️ This script needs sudo privileges" echo " Re-running with sudo..." echo exec sudo "$0" "$@" fi SERVICE_NAME="daemoncontrol.service" SYSTEMD_DIR="/etc/systemd/system" # Stop service if running echo "🛑 Stopping service..." systemctl stop "$SERVICE_NAME" 2>/dev/null || true # Disable service echo "❌ Disabling service..." systemctl disable "$SERVICE_NAME" 2>/dev/null || true # Remove service file if [ -f "$SYSTEMD_DIR/$SERVICE_NAME" ]; then echo "🗑️ Removing service file..." rm "$SYSTEMD_DIR/$SERVICE_NAME" fi # Reload systemd daemon echo "🔄 Reloading systemd daemon..." systemctl daemon-reload echo echo "========================================" echo " Uninstallation Complete! ✅" echo "========================================" echo echo "The DaemonControl service has been removed." echo "Your jobs and database are still intact in ~/.config/daemon-control/" echo