增加openresty

master
pan 4 years ago
parent da279228a4
commit 24933dc321
  1. 6
      shell/killNode
  2. 12
      shell/savePid
  3. 22
      shell/updateRisk

@ -1,13 +1,13 @@
#!/bin/sh #!/bin/sh
#杀死进程 #杀死进程
if [ -e *.log ] if [ -e pid ]
then then
pid=`stat *.log|awk 'NR>1{next}{c=$0;gsub(/\D/,"",c);print c}'` pid=`echo pid`
kill -9 $pid kill -9 $pid
if [ $? -eq 0 ] if [ $? -eq 0 ]
then then
echo "kill $pid success" echo "kill $pid success"
rm -f *.log rm -f pid
fi fi
fi fi
./run.sh ./run.sh

@ -1,16 +1,18 @@
#!/bin/sh #!/bin/sh
#保存应用进程pid #保存应用进程pid
echo "findPort $1" echo "findPort $1"
#重试时间
second=5s
while true while true
do do
pid=`findPortPid $1` pid=`findPortPid $1`
if [ -z $pid ] if [ `$pid|wc -l` -eq 0 ]
then then
echo "pid not found!!!" echo "没有找到端口$1的pid,$second后重试"
sleep 1s sleep $second
else else
echo "pid is $pid" echo "端口$1的pid:$pid"
touch $pid.log && chmod +x $pid.log echo $pid>pid
break break
fi fi
done done

@ -1,6 +1,8 @@
#!/bin/sh #!/bin/sh
#自动部署脚本 #自动部署脚本
echo $$>$1.pid
cd /app cd /app
source riskenv source riskenv
@ -22,14 +24,22 @@ function run(){
fi fi
} }
#检查是否正在部署 #如果当前存在自动部署进程直接kill掉
result=`ps -ef|grep 'updateRisk $1'|wc -l` if [ `ls -l *.pid|wc -l` -gt 0 ]
echo $result then
if [ ! -z $result ] for file in *.pid
do
pid=`cat $file`
kill -9 $pid
if [ $? -eq 0 ]
then then
echo "检测到自动部署$1进程在运行,直接kill掉" echo "成功杀死进程:$pid"
kill -9 $result rm -f $file
fi
done
fi fi
run $1 run $1
rm -f $1.pid

Loading…
Cancel
Save