#! /bin/sh 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" # cd ~/tt/tt-tcp #if= "./log-"$cur_dateTime".txt" # f="./log-"${cur_dateTime}".txt" # mv "./rxlog.txt" "rxlog/rxlog-"${cur_dateTime}".txt" #cd /root/tt/tt-tcp #mv rxlog.txt "./rxlog-"$cur_dateTime".txt" # nohup python3 -u ./server.py >>$f 2>&1 & nohup python3 -u ./server.py & fi sleep 5 done