20 lines
513 B
Bash
Executable File
20 lines
513 B
Bash
Executable File
#! /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"
|
|
#cur_dateTime=$(date +%Y-%m-%d_%H-%m-%s)
|
|
f= "./log-"${cur_dateTime}".txt"
|
|
#mv log.txt $f
|
|
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
|