zoukankan      html  css  js  c++  java
  • 自编自演的Linux脚本

    启动全服务脚本

    #!/bin/bash
    
    cd `dirname $0`
    
    BIN_DIR=`pwd`
    
    COUNT=0
    
    function deal(){
       #echo $1 ;
       #cat $2/stdout.log |grep -w 'Main server started' |wc -l;
       sh $1/start.sh ;
       while [ $COUNT -lt 1 ]; do    
             echo -e ".c"
             sleep 1 
             COUNT=`cat $2/stdout.log |grep -w 'Main server started' |wc -l`
             if [ $COUNT -gt 0 ]; then
                break
             fi
      done
    }
    
    for i in $(ls |grep Service)
     do
       #echo $BIN_DIR/$i
       echo -e "Starting the $i ...c"
       deal $BIN_DIR/$i/bin $BIN_DIR/$i/logs;
     done

    统计服务数量

    ps -ef | grep java | grep Service |wc -l;

    打印服务名

     for i in $(jps |grep Main | awk '{print $1}'); do ll /proc/$i |grep cwd |awk '{print $11}' ; done      
     
    杀服务脚本
     for i in $(jps |grep Main | awk '{print $1}'); do kill -9 $i ; done
     
     
  • 相关阅读:
    pod间访问
    Android地图下钻(坑我好久)
    学习进度23
    学习进度22
    人月神话读后感03
    团队介绍
    人月神话读后感02
    学习进度21
    学习进度20
    学习进度19
  • 原文地址:https://www.cnblogs.com/atomicbomb/p/6927687.html
Copyright © 2011-2022 走看看