test: monitor test
This commit is contained in:
Executable
+38
@@ -0,0 +1,38 @@
|
||||
#!/bin/bash
|
||||
|
||||
# 停止文件监控脚本
|
||||
|
||||
PROJECT_DIR="/Users/chufeng/.openclaw/sanguo_projects/sanguo_quant_live"
|
||||
PID_FILE="$PROJECT_DIR/watcher.pid"
|
||||
|
||||
if [ ! -f "$PID_FILE" ]; then
|
||||
echo "File watcher is not running (no PID file found)"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
pid=$(cat "$PID_FILE")
|
||||
|
||||
if ps -p "$pid" > /dev/null 2>&1; then
|
||||
echo "Stopping file watcher (PID: $pid)..."
|
||||
kill "$pid"
|
||||
|
||||
# 等待进程结束
|
||||
for i in {1..10}; do
|
||||
if ! ps -p "$pid" > /dev/null 2>&1; then
|
||||
break
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
|
||||
# 强制终止如果还活着
|
||||
if ps -p "$pid" > /dev/null 2>&1; then
|
||||
echo "Force killing process..."
|
||||
kill -9 "$pid"
|
||||
fi
|
||||
|
||||
rm -f "$PID_FILE"
|
||||
echo "File watcher stopped"
|
||||
else
|
||||
echo "Process $pid not found, removing stale PID file"
|
||||
rm -f "$PID_FILE"
|
||||
fi
|
||||
Reference in New Issue
Block a user