tt-server/run_tt_server.sh

27 lines
676 B
Bash
Executable File

#!/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}
cd ~/tt/tt-tcp
#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 &
nohup ./restart.sh >> reboot.log &
echo "Done."