auto-sync: 2026-03-26 00:58:29
This commit is contained in:
+13
-30
@@ -1,38 +1,21 @@
|
||||
#!/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)"
|
||||
if [ ! -f "../watcher.pid" ]; then
|
||||
echo "✓ No PID file found, watcher not running"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
pid=$(cat "$PID_FILE")
|
||||
PID=$(cat "../watcher.pid")
|
||||
|
||||
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"
|
||||
if kill -0 $PID 2>/dev/null; then
|
||||
echo "✓ Stopping file watcher (PID $PID)"
|
||||
kill $PID
|
||||
rm -f "../watcher.pid"
|
||||
echo "✓ Stopped"
|
||||
else
|
||||
echo "Process $pid not found, removing stale PID file"
|
||||
rm -f "$PID_FILE"
|
||||
fi
|
||||
echo "✓ Process $PID not running, removing PID file"
|
||||
rm -f "../watcher.pid"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user