#!/bin/bash # Stop ktv-synth-service SERVICE_NAME="ah.py" PID_FILE="nohup.out" # Find process PID=$(ps aux | grep "[p]ython.*$SERVICE_NAME" | awk '{print $2}') if [ -z "$PID" ]; then echo "ktv-synth-service is not running" exit 0 fi echo "Stopping ktv-synth-service (PID: $PID)..." kill $PID # Wait for process to stop for i in {1..10}; do if ! ps -p $PID > /dev/null 2>&1; then echo "ktv-synth-service stopped successfully" exit 0 fi sleep 1 done # Force kill if still running echo "Force killing ktv-synth-service..." kill -9 $PID echo "ktv-synth-service force stopped"