asr-service/stop.sh

25 lines
515 B
Bash
Executable File

#!/bin/bash
# Stop the asr-service
PID=$(pgrep -f "python ah.py" | head -1)
if [ -z "$PID" ]; then
echo "asr-service is not running"
exit 0
fi
echo "Stopping asr-service (PID: $PID)..."
kill "$PID"
# Wait up to 10 seconds for graceful shutdown
for i in $(seq 1 10); do
if ! kill -0 "$PID" 2>/dev/null; then
echo "asr-service stopped"
exit 0
fi
sleep 1
done
# Force kill if still running
echo "Force killing asr-service (PID: $PID)..."
kill -9 "$PID"
echo "asr-service killed"