码迷,mamicode.com
首页 > 其他好文 > 详细

23.dubbo脚本之stop.sh

时间:2016-07-01 23:13:27      阅读:613      评论:0      收藏:0      [点我收藏+]

标签:sh

#!/bin/bash

cd `dirname $0`

BIN_DIR=`pwd`

cd ..

DEPLOY_DIR=`pwd`

CONF_DIR=$DEPLOY_DIR/conf


SERVER_NAME=`sed ‘/dubbo.application.name/!d;s/.*=//‘ conf/dubbo.properties | tr -d ‘\r‘`


if [ -z "$SERVER_NAME" ]; then

    SERVER_NAME=`hostname`

fi


PIDS=`ps -f | grep java | grep "$CONF_DIR" |awk ‘{print $2}‘`

if [ -z "$PIDS" ]; then

    echo "ERROR: The $SERVER_NAME does not started!"

    exit 1

fi


if [ "$1" != "skip" ]; then

    $BIN_DIR/dump.sh

fi


echo -e "Stopping the $SERVER_NAME ...\c"

for PID in $PIDS ; do

    kill $PID > /dev/null 2>&1

done


COUNT=0

while [ $COUNT -lt 1 ]; do    

    echo -e ".\c"

    sleep 1

    COUNT=1

    for PID in $PIDS ; do

        PID_EXIST=`ps -f -p $PID | grep java`

        if [ -n "$PID_EXIST" ]; then

            COUNT=0

            break

        fi

    done

done


echo "OK!"

echo "PID: $PIDS"


本文出自 “8159085” 博客,请务必保留此出处http://8169085.blog.51cto.com/8159085/1794999

23.dubbo脚本之stop.sh

标签:sh

原文地址:http://8169085.blog.51cto.com/8159085/1794999

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!