自动部署脚本
2014-04-04 13:34
411 查看
# author wangyang
# buildTime 12-06-05
# desc 自动部署脚本
currentDir=`pwd`
#判断命令是否成功执行
isOk(){
if [ $1 = 0 ];then
echo ok
else
echo wrong
fi
}
#依次执行命令
rm -rf sessionserver* tradecore tradeweb
isOk $? > deploy.log
tar xzvf my.tar
isOk $? >> deploy.log
cp -r sessionserver sessionserver_P1
isOk $? >> deploy.log
sed -i '/ServerName/s/s1_2/s1_1/' $currentDir/sessionserver_P1/dist/MEBS_timebargain.xml
isOk $? >> deploy.log
cp -r sessionserver sessionserver_P2
isOk $? >> deploy.log
cp -r sessionserver sessionserver_M1
isOk $? >> deploy.log
sed -i '/ServerName/s/s1_2/m1_1/' $currentDir/sessionserver_M1/dist/MEBS_timebargain.xml
isOk $? >> deploy.log
sed -i '/MultiMode/s/1/2/' $currentDir/sessionserver_M1/dist/MEBS_timebargain.xml
isOk $? >> deploy.log
cp -r sessionserver sessionserver_M2
isOk $? >> deploy.log
sed -i '/ServerName/s/s1_2/m1_2/' $currentDir/sessionserver_M2/dist/MEBS_timebargain.xml
isOk $? >> deploy.log
sed -i '/MultiMode/s/1/2/' $currentDir/sessionserver_M2/dist/MEBS_timebargain.xml
isOk $? >> deploy.log
sed -i '/ServerName/s/tr1/localhost\.localdomain/' $currentDir/tradecore/dist/MEBS_timebargain.xml
isOk $? >> deploy.log
cp -r $currentDir/tradeweb/build/classes $currentDir/tradeweb-tomcat6/webapps/tradeweb/WEB-INF
isOk $? >> deploy.log
cp $currentDir/tradeweb/libs/runtime/* $currentDir/tradeweb-tomcat6/webapps/tradeweb/WEB-INF/lib
isOk $? >> deploy.log
#强制杀掉已运行的进程
ps -ef | grep sync_new | grep -v grep | awk '{print $2}' | xargs kill -9
isOk $? >> deploy.log
#逐个开启进程
cd $currentDir/sessionserver_P1/dist
bash startSession.sh
isOk $? >> $currentDir/deploy.log
cd $currentDir/sessionserver_P2/dist
bash startSession.sh
isOk $? >> $currentDir/deploy.log
cd $currentDir/sessionserver_M1/dist
bash startSession.sh
isOk $? >> $currentDir/deploy.log
cd $currentDir/sessionserver_M2/dist
bash startSession.sh
isOk $? >> $currentDir/deploy.log
cd $currentDir/tradecore/dist
bash startCore.sh
isOk $? >> $currentDir/deploy.log
cd $currentDir/tradeweb-tomcat6/bin
bash startup.sh
isOk $? >> $currentDir/deploy.log
#根据命令成功执行条数,判断是否部署成功
#cd -
cd $currentDir
num=`cat deploy.log | grep -o ok | wc -l`
if [ $num = 21 ]; then
echo 'bu shu cheng gong' >> deploy.log
fi
# buildTime 12-06-05
# desc 自动部署脚本
currentDir=`pwd`
#判断命令是否成功执行
isOk(){
if [ $1 = 0 ];then
echo ok
else
echo wrong
fi
}
#依次执行命令
rm -rf sessionserver* tradecore tradeweb
isOk $? > deploy.log
tar xzvf my.tar
isOk $? >> deploy.log
cp -r sessionserver sessionserver_P1
isOk $? >> deploy.log
sed -i '/ServerName/s/s1_2/s1_1/' $currentDir/sessionserver_P1/dist/MEBS_timebargain.xml
isOk $? >> deploy.log
cp -r sessionserver sessionserver_P2
isOk $? >> deploy.log
cp -r sessionserver sessionserver_M1
isOk $? >> deploy.log
sed -i '/ServerName/s/s1_2/m1_1/' $currentDir/sessionserver_M1/dist/MEBS_timebargain.xml
isOk $? >> deploy.log
sed -i '/MultiMode/s/1/2/' $currentDir/sessionserver_M1/dist/MEBS_timebargain.xml
isOk $? >> deploy.log
cp -r sessionserver sessionserver_M2
isOk $? >> deploy.log
sed -i '/ServerName/s/s1_2/m1_2/' $currentDir/sessionserver_M2/dist/MEBS_timebargain.xml
isOk $? >> deploy.log
sed -i '/MultiMode/s/1/2/' $currentDir/sessionserver_M2/dist/MEBS_timebargain.xml
isOk $? >> deploy.log
sed -i '/ServerName/s/tr1/localhost\.localdomain/' $currentDir/tradecore/dist/MEBS_timebargain.xml
isOk $? >> deploy.log
cp -r $currentDir/tradeweb/build/classes $currentDir/tradeweb-tomcat6/webapps/tradeweb/WEB-INF
isOk $? >> deploy.log
cp $currentDir/tradeweb/libs/runtime/* $currentDir/tradeweb-tomcat6/webapps/tradeweb/WEB-INF/lib
isOk $? >> deploy.log
#强制杀掉已运行的进程
ps -ef | grep sync_new | grep -v grep | awk '{print $2}' | xargs kill -9
isOk $? >> deploy.log
#逐个开启进程
cd $currentDir/sessionserver_P1/dist
bash startSession.sh
isOk $? >> $currentDir/deploy.log
cd $currentDir/sessionserver_P2/dist
bash startSession.sh
isOk $? >> $currentDir/deploy.log
cd $currentDir/sessionserver_M1/dist
bash startSession.sh
isOk $? >> $currentDir/deploy.log
cd $currentDir/sessionserver_M2/dist
bash startSession.sh
isOk $? >> $currentDir/deploy.log
cd $currentDir/tradecore/dist
bash startCore.sh
isOk $? >> $currentDir/deploy.log
cd $currentDir/tradeweb-tomcat6/bin
bash startup.sh
isOk $? >> $currentDir/deploy.log
#根据命令成功执行条数,判断是否部署成功
#cd -
cd $currentDir
num=`cat deploy.log | grep -o ok | wc -l`
if [ $num = 21 ]; then
echo 'bu shu cheng gong' >> deploy.log
fi
相关文章推荐
- LNMP自动部署脚本
- Google Appengine 的自动部署脚本
- 我在写shell自动部署脚本碰到的问题
- 【自动构建系列】自动部署环境的shell脚本
- 在Ubuntu上自动部署Jetty的shell脚本
- sentinel redis 集群部署+zabbix监控配置+性能测试+多实例自动配置脚本
- 使用ant脚本编译web工程并自动部署到tomcat
- SHELL脚本自动部署KVM虚拟化
- linux下持续集成自动部署脚本,自动从jekins拉取war包并重新部署 (我去,一个大坑,if中的变量要双引号引起来,不然始终是true)
- tomcat+jenks环境自动部署脚本
- tomcat多实例自动部署脚本
- Linux 基础用法(十三) ———— 自动部署虚拟机脚本、DHCP、HTTP、将服务添加到防火墙规则
- FastDFS 自动部署和配置脚本
- linux下自动部署Teamcenter Enterprise 的服务端脚本
- Jenkins tomcat自动部署脚本
- 自动部署脚本 Linux shell
- PXE项目实战,通过编写脚本自动安装系统时批量部署服务器所需要的所有服务
- 做了一个简易的git 代码自动部署脚本
- linux实现自动部署tomcat脚本
- 自动部署dhcp服务 脚本