#! /bin/sh ### # @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 ### 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 cd /root/tt/tt-tcp mv rxlog.txt "./rxlog-"${cur_dateTime}".txt" nohup python3 -u ./server.py >>${f} 2>&1 & else #echo ${cur_dateTime}" ---- ./server.py program is running" fi sleep 5 done