From 4f8d97bb21468994553189302f3f4c9ceb1e5ce0 Mon Sep 17 00:00:00 2001 From: pan <1029559041@qq.com> Date: Fri, 9 Oct 2020 19:23:38 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BF=90=E8=A1=8C=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- run.sh | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/run.sh b/run.sh index 65e850d..2fd326c 100644 --- a/run.sh +++ b/run.sh @@ -3,4 +3,23 @@ export PORT=2233 export webClient=http://localhost:5000 -nohup yarn start & +function run(){ + nohup yarn start & + findPortPid $PORT>$PORT.log +} + +if [ -e *.pid ] +then + pid=`stat *.pid|awk 'NR>1{next}{c=$0;gsub(/\D/,"",c);print c}'` + kill -9 pid + if [ $? -eq 0 ] + then + echo 'kill $pid success' + rm -f *.pid + run() + else + echo 'kill $pid error' +else + run() +fi +