Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2295522
  • 博文数量: 276
  • 博客积分: 5998
  • 博客等级: 大校
  • 技术积分: 5175
  • 用 户 组: 普通用户
  • 注册时间: 2010-12-24 14:43
文章分类

全部博文(276)

文章存档

2014年(25)

2013年(11)

2012年(69)

2011年(167)

2010年(4)

分类: Python/Ruby

2011-07-21 00:51:18

#!/bin/bash
name="search"
allip="0 1 2 3 4 5 6 7 8 9 sys"
alltype="master slave"

#allip="indexserver0 indexserver1"
dir=/home/search/
if [[ $1 == "" ]]; then
   echo "Bad usage,like:"
   echo "deploy|start|stop [servername{0|1|2|3|4|5|6|7|8|9|sys}] [type{master|slave}]"
   exit
fi
if [[ $2 != "" ]] && [[ $3 != "" ]]; then
   allip=$2
   alltype=$3
   #echo $allip
fi
case $1 in
    deploy)      remoteip=$allip
                command="deploy.sh"
    ;;
    start)      remoteip=$allip
                command="start.sh"
    ;;
    stop)      remoteip=$allip
                command="stop.sh"
    ;;
esac
for type in $alltype; do
   for ip in $allip; do
       echo ssh $name$type$ip $dir$name$type/$command
       ssh $name$type$ip $dir$name$type/$command
       sleep 5
   done
   sleep 30
done
阅读(2782) | 评论(0) | 转发(2) |
给主人留下些什么吧!~~