git拉源码maven构建后部署脚本详解
部署某个中间件到测试机器脚本
从git取源码,再maven构建,将jar拷贝到服务器,备份旧版本,重启。
#!/bin/bash server_ips=(132.121.100.44132.121.100.45132.121.100.46132.121.100.47) git_url=http://seaboat:123456@132.122.1.21:8888/splan/dbpool-src.git port=22 user=seaboat dbproxy_base=/data/seaboat/dbproxy version=dbpool-service-1.2.2.jar currentTime=`date'+%Y%m%d%H%M%S'` dir=`pwd` functiondoGit(){ echo"starting........" rm-rf./dbpool-src gitclone$git_url echo"gitclonesuccessed......." } functionmavenBuild(){ echo"mavenbuilding.........." set-e cddbpool-src/dbpool-service mvnclean mvnpackage-Dmaven.test.skip=true echo"mavenbuildssuccessed.........." } functiondeployToServer(){ echo"startingdeploytoserver" foripin${server_ips[@]}; do scp-r$dir/dbpool-src/dbpool-service/target/$version$user@$ip:$dbproxy_base/lib/tmp/ ssh-p$port$user@$ip"cddbproxy/bin;./deploy.sh$version$currentTime" done echo"deploytoserverssuccessfully!" } doGit mavenBuild deployToServer
中间件的部署脚本deploy.sh
#!/bin/bash ./etc/profile cd cddbproxy/lib/tmp cp-f$1../$1.$2 cp-f$1../$1 cd cddbproxy/bin ./shutdown.sh ./startup.sh
感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!