tt-server/run_tt_server.sh

26 lines
643 B
Bash
Raw Normal View History

2023-04-19 11:55:42 +00:00
#!/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}
2023-04-23 10:32:35 +00:00
cd /root/tt/tt-tcp
2023-04-19 11:55:42 +00:00
#mv log.txt "./log-"${cur_dateTime}".txt"
f="./log-"${cur_dateTime}".txt"
mv rxlog.txt "./rxlog-"${cur_dateTime}".txt"
2023-04-23 10:32:35 +00:00
nohup python3 -u ./server.py >>${f} 2>&1 &
2023-04-19 11:55:42 +00:00
nohup ./restart.sh &
echo "Done."