#!/bin/bash # undaemonize.sh # Removes Skier233's NSFW AI Model Server from systemd-based systems # # Usage: sudo ./undaemonize.sh # Check if the script is being run as root if [ "$EUID" -ne 0 ]; then echo "Please run as root." exit fi # Check if the script is being run on a systemd-based system if [ ! -d "/etc/systemd" ]; then echo "This script only works on systemd-based systems" exit fi # Variables service_name="nsfw_ai_model_server" echo "Stopping and disabling the service..." systemctl disable --now $service_name if [ $? -ne 0 ]; then echo "Error disabling the service, please check the output above." exit fi echo "Removing the service file..." rm /etc/systemd/system/$service_name.service if [ $? -ne 0 ]; then echo "Error removing the service file, please check the output above." exit fi echo "Reloading the systemd daemon..." systemctl daemon-reload if [ $? -ne 0 ]; then echo "Error reloading the systemd daemon, please check the output above." exit fi echo "Service removed."