Files
webtest-agent/start.sh
T

26 lines
827 B
Bash
Executable File

#!/bin/bash
# webtest-agent 启动脚本
cd "$(dirname "$0")"
export PATH="/home/openclaw/.nvm/versions/node/v24.15.0/bin:$PATH"
export XDG_RUNTIME_DIR=/tmp/xdg-rt
mkdir -p "$XDG_RUNTIME_DIR" && chmod 700 "$XDG_RUNTIME_DIR"
mkdir -p logs
if [ -n "$1" ] && [ "$1" = "stop" ]; then
PID=$(ss -tlnp 2>/dev/null | grep ":16061 " | grep -oP 'pid=\K[0-9]+' | head -1)
if [ -n "$PID" ]; then kill "$PID" && echo "已停止 (PID $PID)"; else echo "未在运行"; fi
exit 0
fi
# 端口占用检查
if ss -tlnp 2>/dev/null | grep -q ":16061 "; then
echo "⚠️ 端口 16061 已被占用,无法启动!"
ss -tlnp | grep ":16061 "
exit 1
fi
nohup /home/hz1/miniconda3/envs/openclaw/bin/python3 app.py > logs/app.log 2>&1 &
echo "✅ webtest-agent 已启动 (PID $!)"
sleep 1
curl -s http://localhost:16061/health && echo