华荣三照明、合信、荣欣八组合馈电

This commit is contained in:
冯佳
2025-06-25 11:36:43 +08:00
parent 37d39f4578
commit 25b3cb7f2e
494 changed files with 114074 additions and 0 deletions

29
uart_port.sh Normal file
View File

@ -0,0 +1,29 @@
#!/bin/bash
# 设置路径变量
ENV_PATH="/home/zzkj/myenv/bin/activate"
SCRIPT1_PATH="/home/zzkj/MenuPython_QT/uart_port.py"
# 日志文件路径
LOG_FILE="/var/log/uart_port.log"
# 清空日志文件
clear_log_file() {
echo "[$(date '+%y-%m-%d %H:%M:%S')] 清空日志文件" > "$LOG_FILE"
}
# 激活虚拟环境
source "$ENV_PATH"
# 运行uart_port.py
python3 "$SCRIPT1_PATH"
#打印日志显示取消下列注释
# echo "[$(date '+%Y-%m-%d %H:%M:%S')] 启动 uart_port.py" >> "$LOG_FILE"
# python3 "$SCRIPT1_PATH" >> "$LOG_FILE" 2>&1
# echo "[$(date '+%Y-%m-%d %H:%M:%S')] 完成 uart_port.py" >> "$LOG_FILE"
# # 检查日志文件大小是否超过10mb并清空
# if [ $(du -m "$LOG_FILE" | cut -f1) -gt 10 ]; then
# clear_log_file
# fi