启动全服务脚本
#!/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