diff --git a/shell/updateRisk b/shell/updateRisk index e2b9181..c381032 100644 --- a/shell/updateRisk +++ b/shell/updateRisk @@ -1,6 +1,21 @@ #!/bin/sh #自动部署脚本 +#如果当前存在自动部署进程,除当前进程以外其他直接kill掉 +if [ `ls -l *.pid|wc -l` -gt 0 ] +then + for file in *.pid + do + pid=`cat $file` + kill -9 $pid + if [ $? -eq 0 ] + then + echo "成功杀死进程:$pid" + rm -f $file + fi + done +fi + echo $$>$1.pid cd /app @@ -24,21 +39,6 @@ function run(){ fi } -#如果当前存在自动部署进程直接kill掉 -if [ `ls -l *.pid|wc -l` -gt 0 ] -then - for file in *.pid - do - pid=`cat $file` - kill -9 $pid - if [ $? -eq 0 ] - then - echo "成功杀死进程:$pid" - rm -f $file - fi - done -fi - run $1 rm -f $1.pid