`
gaozhonghui
  • 浏览: 245572 次
  • 性别: Icon_minigender_1
  • 来自: 内蒙古自治区
社区版块
存档分类
最新评论

linux 下批量操作web服务

阅读更多
  服务器上的应用很多,一个一个的操作,太麻烦。
  写脚本批量start 、stop 、restart
 
#!/bin/bash
#############################################
# Scripts for rotating catalina daily
# at 2012-06-07
#############################################

workPath=$1
cmd=$2

if [ -z ${workPath} ];then
   echo "参数异常"
   exit
fi

if [ -z ${cmd} ];then
   echo "请输入参数 start stop restart"
   exit
fi


for appPath in ${workPath}*;do

    if [ "stop" = ${cmd} ]||[ "restart" = ${cmd} ]
    then
        ${appPath}/bin/shutdown.sh
        echo "shudown ${cmd} "
    fi

    sleep 3

    if [ "start" = ${cmd} ]||[ "restart" = ${cmd} ]
    then
       ${appPath}/bin/startup.sh
       echo "startUp ${cmd}"
    fi
done

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics