tt-server/restart.sh

29 lines
890 B
Bash
Raw Normal View History

2023-04-19 11:55:42 +00:00
#! /bin/sh
2023-04-23 10:37:20 +00:00
###
# @Author: murmur test@test.test
# @Date: 2023-04-19 19:56:18
# @LastEditors: murmur test@test.test
# @LastEditTime: 2023-04-23 18:36:18
# @FilePath: \tt-tcp\restart.sh
# @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
###
2023-04-19 11:55:42 +00:00
while true
do
monitor=`ps -ef | grep "./server.py" | grep -v grep | wc -l `
cur_dateTime=$(date +%Y-%m-%d_%H-%M-%s)
if [ $monitor -eq 0 ]
then
echo ${cur_dateTime}" --- ./server.py program is not running, restart now"
#cur_dateTime=$(date +%Y-%m-%d_%H-%m-%s)
f= "./log-"${cur_dateTime}".txt"
#mv log.txt $f
2023-04-23 10:37:20 +00:00
cd /root/tt/tt-tcp
2023-04-19 11:55:42 +00:00
mv rxlog.txt "./rxlog-"${cur_dateTime}".txt"
2023-04-23 10:32:35 +00:00
nohup python3 -u ./server.py >>${f} 2>&1 &
2023-04-19 11:55:42 +00:00
else
#echo ${cur_dateTime}" ---- ./server.py program is running"
fi
sleep 5
done