jar批量启动shell


export aaa=aaa.jar
export bbb=bbb.jar
export ccc=ccc.jar

 
case "$1" in
 
start)
        echo "--------aaa 开始启动--------------"
        nohup java -jar -Xms256M -Xmx512M $aaa >logs/aaa.out 2>&1 &
        
        echo "--------bbb开始启动---------------"
        nohup java -jar -Xms256M -Xmx512M $bbb >logs/aaa.out 2>&1 &
        
        echo "--------ccc开始启动---------------"
        nohup java -jar -Xms256M -Xmx512M $ccc >logs/bbb.out 2>&1 &
        
       
        echo "===startAll success==="
        ;;
 
 stop)
        P_ID=`ps -ef | grep -w $aaa| grep -v "grep" | awk '{print $2}'`
        if [ "$P_ID" == "" ]; then
            echo "===aaa process not exists or stop success"
        else
            kill -9 $P_ID
            echo "aaa killed success"
        fi
		P_ID=`ps -ef | grep -w $bbb | grep -v "grep" | awk '{print $2}'`
        if [ "$P_ID" == "" ]; then
            echo "===bbb process not exists or stop success"
        else
            kill -9 $P_ID
            echo "bbb killed success"
        fi
		 P_ID=`ps -ef | grep -w $ccc | grep -v "grep" | awk '{print $2}'`
        if [ "$P_ID" == "" ]; then
            echo "===ccc process not exists or stop success"
        else
            kill -9 $P_ID
            echo "ccc killed success"
        fi
		
        
        echo "===stop success==="
        ;;   
 
restart)
        $0 stop
        sleep 2
        $0 start
        echo "===restart success==="
        ;;   
esac	
exit 0
发布了5 篇原创文章 · 获赞 0 · 访问量 75

猜你喜欢

转载自blog.csdn.net/swj_soft/article/details/104041699