add sh files
This commit is contained in:
parent
bb734a37e6
commit
e64dc5264a
19
restart.sh
Executable file
19
restart.sh
Executable file
@ -0,0 +1,19 @@
|
||||
#! /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
|
25
run_tt_server.sh
Executable file
25
run_tt_server.sh
Executable file
@ -0,0 +1,25 @@
|
||||
#!/bin/sh
|
||||
|
||||
kill_with_pid() {
|
||||
pids=`ps aux | grep "./server.py" | grep -v grep | awk '{print $2}'`
|
||||
if [ -n "$pids" ]; then
|
||||
echo “service is running, pid is ${pids}""
|
||||
echo "kill the service."
|
||||
kill -9 $pids
|
||||
else
|
||||
echo "service is not running"
|
||||
fi
|
||||
}
|
||||
kill_with_pid
|
||||
echo "Now run new service."
|
||||
#
|
||||
cur_dateTime=$(date +%Y-%m-%d_%H-%M)
|
||||
#cur_dateTime=$(date +%Y-%m-%d_%H-%m-%s)
|
||||
echo ${cur_dateTime}
|
||||
|
||||
#mv log.txt "./log-"${cur_dateTime}".txt"
|
||||
f="./log-"${cur_dateTime}".txt"
|
||||
mv rxlog.txt "./rxlog-"${cur_dateTime}".txt"
|
||||
nohup python3 -u ./server.py >>$f 2>&1 &
|
||||
nohup ./restart.sh &
|
||||
echo "Done."
|
Loading…
Reference in New Issue
Block a user