Files
runaway-process-killer/uninstall.sh
2026-01-22 18:46:43 -05:00

49 lines
1.3 KiB
Bash
Executable File

#!/bin/bash
set -e
# Runaway Process Killer - Uninstallation Script
echo "============================================"
echo "Runaway Process Killer - Uninstallation"
echo "============================================"
echo ""
# Check root
if [ "$EUID" -ne 0 ]; then
echo "Error: Please run as root (sudo ./uninstall.sh)"
exit 1
fi
read -p "This will remove earlyoom and monit. Continue? [y/N] " -n 1 -r
echo ""
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
echo "Aborted."
exit 0
fi
echo "[1/4] Stopping services..."
systemctl stop earlyoom monit 2>/dev/null || true
echo "[2/4] Disabling services..."
systemctl disable earlyoom monit 2>/dev/null || true
echo "[3/4] Removing packages..."
apt-get remove -y earlyoom monit
echo "[4/4] Cleaning up config files..."
rm -f /usr/local/bin/kill-top-cpu.sh
rm -f /usr/local/bin/kill-orphan-claude.sh
rm -f /etc/monit/conf.d/cpu-killer
rm -f /etc/monit/conf.d/orphan-claude-killer
echo ""
echo "============================================"
echo "Uninstallation Complete!"
echo "============================================"
echo ""
echo "Note: /etc/default/earlyoom and /etc/monit/monitrc may still exist."
echo "Remove manually if needed:"
echo " sudo rm -f /etc/default/earlyoom"
echo " sudo apt purge monit # removes /etc/monit/"
echo ""