Files
2.13-Ink-screen-clock/bin/start.sh
2025-01-12 16:18:33 +08:00

19 lines
574 B
Bash
Executable File
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
f_name=main.py
dir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
logdir=${dir%/*}/log
screen_name="main_screen"
# 创建日志目录,如果它不存在的话
mkdir -p $logdir
# 结束与指定screen_name相关的所有screen会话可选如果您想要保留这个步骤
pids=$(screen -ls | grep $screen_name | awk -F '.' '{print $1}' | awk '{print $1}')
for pid in $pids; do
screen -S $pid -X quit
done
# 使用nohup运行Python脚本并将输出重定向到日志文件
nohup /usr/bin/python3 -u $dir/$f_name > $logdir/info.log 2>&1 &