45 lines
1.0 KiB
Bash
Executable File

#!/bin/bash
# run_thermometry.sh
# 记录启动日志
echo "[$(date '+%Y-%m-%d %H:%M:%S')] Starting thermometry with args: $@" >> /data/logs/thermometry_start.log
# 解析参数
RTSP_URL=""
TCP_PORT=""
CHANNEL="0"
while [[ $# -gt 0 ]]; do
case $1 in
-s)
RTSP_URL="$2"
shift 2
;;
-t)
TCP_PORT="$2"
shift 2
;;
-c)
CHANNEL="$2"
shift 2
;;
*)
shift
;;
esac
done
echo "[$(date '+%Y-%m-%d %H:%M:%S')] RTSP: $RTSP_URL, TCP Port: $TCP_PORT, Channel: $CHANNEL" >> /data/logs/thermometry_start.log
# 检查参数
if [ -z "$RTSP_URL" ] || [ -z "$TCP_PORT" ]; then
echo "Usage: $0 -s <rtsp_url> -t <tcp_port> [-c <channel>]"
exit 1
fi
# 启动温度程序
cd /usr/local/rk1808-docker/models
./thermometry -s "$RTSP_URL" -t "$TCP_PORT" -c "$CHANNEL"
echo "[$(date '+%Y-%m-%d %H:%M:%S')] Thermometry exited with code: $?" >> /data/logs/thermometry_start.log