#!/bin/bash # filepath: /home/setyotontowi/BackendProject/gogsmilestone/uninstall.sh # Dynamically determine the project directory PROJECT_DIR=$(dirname "$(realpath "$0")") echo "Uninstalling the project from $PROJECT_DIR..." # Step 1: Stop and disable the systemd service SERVICE_FILE="/etc/systemd/system/gogmilestone.service" if [ -f "$SERVICE_FILE" ]; then echo "Stopping the gogmilestone service..." sudo systemctl stop gogmilestone echo "Disabling the gogmilestone service..." sudo systemctl disable gogmilestone echo "Removing the gogmilestone service file..." sudo rm -f "$SERVICE_FILE" echo "Reloading systemd daemon..." sudo systemctl daemon-reload else echo "Service file not found. Skipping service removal." fi # Step 2: Delete the virtual environment if [ -d "$PROJECT_DIR/venv" ]; then echo "Removing the virtual environment..." rm -rf "$PROJECT_DIR/venv" else echo "Virtual environment not found. Skipping removal." fi echo "Uninstallation complete."