- ArbTable: removed slice(0,10) cap, shows all 42 opps (21x2) - PriceTable: added net_bg_to_hl and net_hl_to_bg columns - Backend SSE: sends net profit for both directions per coin
36 lines
912 B
Bash
36 lines
912 B
Bash
#!/bin/bash
|
|
# Morning summary script — triggered by cron at 8 AM
|
|
|
|
PROJECT_DIR="/home/jack/Project/exchange-monitor-go"
|
|
STATS_FILE="$PROJECT_DIR/trade_stats.txt"
|
|
LOG_FILE="$PROJECT_DIR/morning_summary.txt"
|
|
|
|
# Find the PID of the exchange-monitor process
|
|
PID=$(pgrep -f "exchange-monitor" | head -1)
|
|
|
|
if [ -n "$PID" ]; then
|
|
# Send SIGUSR1 to dump stats
|
|
kill -USR1 "$PID" 2>/dev/null
|
|
sleep 2
|
|
|
|
# Read stats
|
|
if [ -f "$STATS_FILE" ]; then
|
|
cat "$STATS_FILE"
|
|
echo ""
|
|
echo "=== 程序状态 ==="
|
|
ps -p "$PID" -o pid,etime,cmd --no-headers 2>/dev/null || echo "进程已结束"
|
|
fi
|
|
|
|
# Kill the process
|
|
kill "$PID" 2>/dev/null
|
|
sleep 1
|
|
kill -0 "$PID" 2>/dev/null && kill -9 "$PID" 2>/dev/null
|
|
|
|
echo ""
|
|
echo "程序已停止 (PID: $PID)"
|
|
else
|
|
echo "未找到运行中的 exchange-monitor 进程"
|
|
fi
|
|
|
|
echo "=== 报告完成 ==="
|