git拉源码maven构建后部署脚本详解
部署某个中间件到测试机器脚本
从git取源码,再maven构建,将jar拷贝到服务器,备份旧版本,重启。
#!/bin/bash server_ips=(132.121.100.44 132.121.100.45 132.121.100.46 132.121.100.47) git_url=http://seaboat:[email protected]: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` function doGit(){ echo "starting........" rm -rf ./dbpool-src git clone $git_url echo "git clone successed......." } function mavenBuild(){ echo "maven building.......... " set -e cd dbpool-src/dbpool-service mvn clean mvn package -Dmaven.test.skip=true echo "maven builds successed.........." } function deployToServer(){ echo "starting deploy to server" for ip in ${server_ips[@]}; do scp -r $dir/dbpool-src/dbpool-service/target/$version $user@$ip:$dbproxy_base/lib/tmp/ ssh -p $port $user@$ip "cd dbproxy/bin; ./deploy.sh $version $currentTime" done echo "deploy to servers successfully!" } doGit mavenBuild deployToServer
中间件的部署脚本 deploy.sh
#!/bin/bash . /etc/profile cd cd dbproxy/lib/tmp cp -f $1 ../$1.$2 cp -f $1 ../$1 cd cd dbproxy/bin ./shutdown.sh ./startup.sh
感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!
相关推荐
laisean 2020-11-11
Julyth 2020-10-16
laisean 2020-09-27
flycappuccino 2020-09-27
liguojia 2020-09-27
87201442 2020-10-15
MXstudying 2020-09-05
WasteLand 2020-09-15
<?php. if (!empty($_POST)) {. $data1 = $_POST["data1"];$data2 = $_POST["data2"];$fuhao = $_POST["fuh
mathchao 2020-09-15
tvk 2020-07-30
Zaratustra 2020-07-29
zhaowj00 2020-07-26
Zaratustra 2020-06-26
ldcwang 2020-06-25
拿什么来拯救自己 2020-06-21
IsanaYashiro 2020-06-16
赵家小少爷 2020-06-14
大牛牛 2020-06-14