Chinaunix首页 | 论坛 | 博客
  • 博客访问: 269148
  • 博文数量: 103
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 705
  • 用 户 组: 普通用户
  • 注册时间: 2013-05-02 16:15
文章分类

全部博文(103)

文章存档

2014年(8)

2013年(95)

我的朋友

分类: Python/Ruby

2013-09-03 16:33:36

#!/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
阅读(909) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~