1.介绍
提供批量部署脚本
2.脚本
#构建工程名称PROJECT_NAME=pro-web#构建目录BUILD_HOME=$JDEPLOY_HOME/data/build#部署目录DEPLOY_HOME="/home/data/java"#目标IPIP=(10.10.136.85 10.10.136.41)#当前时间CURTIME=`date +%m%d%H%M` for server in ${IP[*]};do #远程部署 DEPLOY_PROJECT_PATH=$DEPLOY_HOME/$PROJECT_NAME-$CURTIME ssh root@${server} "rm -rf $DEPLOY_PROJECT_PATH/* && mkdir -p $DEPLOY_PROJECT_PATH" scp target/$PROJECT_NAME.war root@${server}:$DEPLOY_PROJECT_PATH/$PROJECT_NAME.war ssh root@${server} "mkdir -p $DEPLOY_PROJECT_PATH; cd $DEPLOY_PROJECT_PATH; unzip -q $PROJECT_NAME.war && rm -f $PROJECT_NAME.war" ssh root@${server} "rm -rf $DEPLOY_HOME/web-deploy" ssh root@${server} "ln -s $DEPLOY_PROJECT_PATH $DEPLOY_HOME/web-deploy" ssh root@${server} "/home/tools/tomcat-web/bin/restart.sh" ssh root@${server} "echo $DEPLOY_PROJECT_PATH >> $DEPLOY_HOME/$PROJECT_NAME.version"done