scense/stop.sh

19 lines
493 B
Bash
Executable File

#!/usr/bin/env bash
# scense 停止脚本(优雅停止,保留日志)
pids=$(pgrep -f "python.*app/scense.py" || true)
if [ -z "${pids}" ]; then
echo "scense not running"
exit 0
fi
pkill -TERM -f "python.*app/scense.py" || true
sleep 2
pids=$(pgrep -f "python.*app/scense.py" || true)
if [ -n "${pids}" ]; then
sleep 2
pids=$(pgrep -f "python.*app/scense.py" || true)
if [ -n "${pids}" ]; then
echo "WARN: still alive: ${pids}"
fi
fi
echo "scense stopped"