|
1 | 1 | #! /bin/shell |
2 | 2 |
|
| 3 | +# Copyright 2019-2029 geekidea(https://github.com/geekidea) |
| 4 | +# |
| 5 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | +# you may not use this file except in compliance with the License. |
| 7 | +# You may obtain a copy of the License at |
| 8 | +# |
| 9 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | +# |
| 11 | +# Unless required by applicable law or agreed to in writing, software |
| 12 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | +# See the License for the specific language governing permissions and |
| 15 | +# limitations under the License. |
| 16 | + |
| 17 | +#====================================================================== |
| 18 | +# 1. 下载或更新spring-boot-plus版本库 |
| 19 | +# 2. maven打包 |
| 20 | +# 3. 运行spring-boot-plus |
| 21 | +# 4. 访问项目 |
| 22 | +# author: geekidea |
| 23 | +# date: 2019-9-6 |
| 24 | +#====================================================================== |
| 25 | + |
| 26 | +# 版本库路径 |
| 27 | +PROJECT_REPO="https://github.com/geekidea/spring-boot-plus.git" |
| 28 | +# 项目名称 |
| 29 | +PROJECT_NAME="spring-boot-plus" |
| 30 | +# 当前时间 |
| 31 | +NOW=$(date --date='0 days ago' "+%Y-%m-%d-%H-%M-%S") |
| 32 | +echo "${NOW}" |
| 33 | + |
| 34 | +# 1. 下载或更新spring-boot-plus版本库 |
| 35 | +# 先判断当前目录下是否有spring-boot-plus目录 |
| 36 | +# 如果有,则执行git pull |
| 37 | +# 如果没有,则clone |
| 38 | +if [ ! -d "/spring-boot-plus" ]; then |
| 39 | + git clone ${PROJECT_REPO} |
| 40 | +else |
| 41 | + git pull |
| 42 | +fi |
| 43 | + |
| 44 | +# 2. maven打包 |
| 45 | +cd $(PROJECT_NAME) |
| 46 | +mvn clean package -Ptest |
| 47 | + |
| 48 | +# 3. 停服 |
| 49 | +# cd到项目源代码同级目录 |
| 50 | +cd ../ |
| 51 | +# 停服 |
| 52 | +sh ${PROJECT_NAME}-server/bin/shutdown.sh |
| 53 | + |
| 54 | +# 4. 移动spring-boot-plus-server-assembly.tar.gz到项目同级目录下 |
| 55 | +# 备份上一次的server |
| 56 | +echo "${NOW}" |
| 57 | +mv ${PROJECT_NAME}-server ${PROJECT_NAME}-server-"${NOW}" |
| 58 | +# 移动最新打包的server到项目同级目录下 |
| 59 | +mv ${PROJECT_NAME}/target/${PROJECT_NAME}-server-assembly.tar.gz ../../ |
| 60 | + |
| 61 | +# 5. 运行spring-boot-plus |
| 62 | +tar -zxvf ${PROJECT_NAME}-server-assembly.tar.gz |
| 63 | +cd ${PROJECT_NAME}-server/bin |
| 64 | +sh restart.sh |
| 65 | + |
| 66 | +# 6. 访问项目 |
| 67 | +# 输出项目日志 |
| 68 | +# http://localhost:8888/docs |
| 69 | + |
0 commit comments