diff --git a/core/scripts/hysteria2/uninstall.sh b/core/scripts/hysteria2/uninstall.sh index 7cfe940..6ee42c4 100644 --- a/core/scripts/hysteria2/uninstall.sh +++ b/core/scripts/hysteria2/uninstall.sh @@ -2,6 +2,16 @@ source /etc/hysteria/core/scripts/path.sh || true echo "Uninstalling Hysteria2..." +SERVICES=( + "hysteria-server.service" + "hysteria-webpanel.service" + "hysteria-caddy.service" + "hysteria-telegram-bot.service" + "hysteria-normal-sub.service" + "hysteria-singbox.service" + "hysteria-ip-limit.service" +) + echo "Running uninstallation script..." bash <(curl -fsSL https://get.hy2.sh/) --remove >/dev/null 2>&1 @@ -12,18 +22,22 @@ else echo "Skipping WARP removal (python3 or CLI_PATH not found)" fi - echo "Removing Hysteria folder..." rm -rf /etc/hysteria >/dev/null 2>&1 echo "Deleting hysteria user..." userdel -r hysteria >/dev/null 2>&1 || true -echo "Removing systemd service files..." +echo "Stop/Disabling Hysteria Services..." +for service in "${SERVICES[@]}" "hysteria-server@*.service"; do + echo "Stopping and disabling $service..." + systemctl stop "$service" > /dev/null 2>&1 || true + systemctl disable "$service" > /dev/null 2>&1 || true +done -for service in hysteria-server.service hysteria-webpanel.service hysteria-caddy.service \ - hysteria-telegram-bot.service hysteria-normal-sub.service hysteria-singbox.service \ - hysteria-server@*.service; do +echo "Removing systemd service files..." +for service in "${SERVICES[@]}" "hysteria-server@*.service"; do + echo "Removing service file: $service" rm -f "/etc/systemd/system/$service" "/etc/systemd/system/multi-user.target.wants/$service" >/dev/null 2>&1 done @@ -35,16 +49,8 @@ if crontab -l 2>/dev/null | grep -q "hysteria"; then (crontab -l | grep -v "hysteria" | crontab -) >/dev/null 2>&1 fi - - echo "Removing alias 'hys2' from .bashrc..." sed -i '/alias hys2=.*\/etc\/hysteria\/menu.sh/d' ~/.bashrc 2>/dev/null || true -echo "Stop/Disabling Hysteria Services..." -for service in hysteria-telegram-bot.service hysteria-singbox.service hysteria-webpanel.service hysteria-caddy.service hysteria-normal-sub.service; do - systemctl stop "$service" > /dev/null 2>&1 || true - systemctl disable "$service" > /dev/null 2>&1 || true -done - echo "Hysteria2 uninstalled!" echo ""