kangda/start_sync_robot.sh

22 lines
523 B
Bash
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#! /bin/bash
LOG_DIR="logs/robot"
mkdir -p $LOG_DIR
# 生成日志文件名(使用当前时间)
LOG_FILE="$LOG_DIR/robot_$(date +%Y%m%d_%H%M%S).log"
# 检查当前程序是否已经正在运行.
if pgrep -f "run_sync_robot.py" > /dev/null; then
echo "run_sync_robot 已经在运行中"
exit 1
fi
nohup python run_sync_robot.py > "$LOG_FILE" 2>&1 &
# 保存进程id
echo $! > "$LOG_DIR/robot.pid"
echo "WebSocket客户端已启动日志保存在: $LOG_FILE"
echo "进程ID: $(cat $LOG_DIR/robot.pid)"