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

startallserver

时间:2014-06-05 11:11:43      阅读:243      评论:0      收藏:0      [点我收藏+]

标签:shell   linux   脚本   

[lvhongmin@AY1401201736089361adZ start_svr]$ cat startall_svr.sh 
#!/bin/bash

errpath[0]=‘‘
errnum=0
runnum=0
curr_path=`pwd`

#启动各进程的脚本完整路径及名字

array[${#array[*]}]=/home/lvhongmin/bin/bin.gatemaster/restart_proxy
slp[${#slp[*]}]=5   
array[${#array[*]}]=/home/lvhongmin/bin/bin.connect/restart_proxy
slp[${#slp[*]}]=2
array[${#array[*]}]=/home/lvhongmin/bin/bin.ss.hall/restart_proxy
slp[${#slp[*]}]=2
array[${#array[*]}]=/home/lvhongmin/bin/bin.cornucopia/go.lhm.cornucopia
slp[${#slp[*]}]=2
array[${#array[*]}]=/home/lvhongmin/bin/bin.ddz.match/go.lhm.ddz.match
slp[${#slp[*]}]=2
array[${#array[*]}]=/home/lvhongmin/bin/bin.ddz.pt/go.lhm.ddz.pt
slp[${#slp[*]}]=2
array[${#array[*]}]=/home/lvhongmin/bin/bin.horse/go.lhm.horse
slp[${#slp[*]}]=2
array[${#array[*]}]=/home/lvhongmin/bin/bin.hsz.pt/go.lhm.hsz.pt
slp[${#slp[*]}]=2
array[${#array[*]}]=/home/lvhongmin/bin/bin.jpwl.pt/go.lhm.jpwl.pt
slp[${#slp[*]}]=2
array[${#array[*]}]=/home/lvhongmin/bin/bin.lzddz.pt/go.lhm.lzddz.pt
slp[${#slp[*]}]=2
array[${#array[*]}]=/home/lvhongmin/bin/bin.pklottery/go.lhm.pklottery
slp[${#slp[*]}]=2
array[${#array[*]}]=/home/lvhongmin/bin/bin.six/go.lhm.six
slp[${#slp[*]}]=1
array[${#array[*]}]=/home/lvhongmin/bin/bin.record.lhm/go.lhm.record.svr
slp[${#slp[*]}]=1

#declare -a array
len=${#array[*]}
echo "server num=" $len

for((i=0; i<$len;i++ ))
do
#  echo ${array[$i]}
  exen=${array[$i]}
  slpnum=${slp[$i]}
  if [ -f $exen  ]; then

       echo  ${exen} ‘  >> ‘ $slpnum

      #get the path

       fpath=${exen%/*}

       echo $fpath 

      # go to the path

       cd $fpath

       ${exen}

      #use proper sleep time

       sleep $slpnum
       runnum=`expr $runnum + 1`
   else
       echo ‘  --‘ $exen
       errpathn[$unnum]=$exen    
       errnum=`expr $errnum + 1`   
   fi
done

cd $curr_path

startallserver,布布扣,bubuko.com

startallserver

标签:shell   linux   脚本   

原文地址:http://blog.csdn.net/wusthongmin/article/details/27494753

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