Commit 5ea259e9 by hweeeeeei

删除无用文件

parent 22fbc783
#! /bin/shell
# Copyright 2019-2029 geekidea(https://github.com/geekidea)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#======================================================================
# 1. 下载或更新spring-boot-plus版本库
# 2. maven打包
# 3. 停服
# 4. 备份
# 5. 运行spring-boot-plus
# author: geekidea
# date: 2020-3-25
#======================================================================
NOW=$(date --date='0 days ago' "+%Y-%m-%d-%H-%M-%S")
echo "${NOW}"
PULL_RESULT=""
IS_UPDATE=0
# 项目名称
PROJECT_NAME="spring-boot-plus"
# 版本库路径
REPO_URL="https://gitee.com/geekidea/spring-boot-plus.git"
# 打包文件名称
ASSEMBLY_NAME="spring-boot-plus-server-2.0.tar.gz"
# 服务目录名称
SERVER_DIR="spring-boot-plus-server-2.0"
# 发布的GIT分支名称
DEPLOY_BRANCH=dev
# 发布的Maven Profile
ACTIVE_PROFILE=test
# 1. 下载或更新spring-boot-plus版本库
# 先判断当前目录下是否有spring-boot-plus目录
# 如果有,则执行git pull
# 如果没有,则clone
if [ ! -d "${PROJECT_NAME}" ]; then
git clone ${REPO_URL}
cd ${PROJECT_NAME}
else
cd ${PROJECT_NAME}
# 拉取代码,并获取结果判断,是否有新的代码更新,如果有,则备份之前的server,否则替换
PULL_RESULT=$(git pull)
echo "${PULL_RESULT}"
if [[ ! $PULL_RESULT == *up-to-date* ]]
then
echo "update code..."
IS_UPDATE=1
fi
fi
pwd
git checkout ${DEPLOY_BRANCH}
git branch
# 2. maven打包
mvn clean install -P release,${ACTIVE_PROFILE}
mvn clean package -P release,${ACTIVE_PROFILE}
pwd
# 判断是否生成成功
if [ ! -f "distribution/target/${ASSEMBLY_NAME}" ]; then
echo "maven build fail"
exit
fi
# 3. 停服
cd ..
pwd
if [ -d "${SERVER_DIR}" ]; then
sh ${SERVER_DIR}/bin/shutdown.sh
fi
# 4. 复制spring-boot-plus-server-assembly.tar.gz到项目同级目录下
# 备份之前的server
if [ ! -d "${SERVER_DIR}-back" ]; then
mkdir ${SERVER_DIR}-back
fi
if [[ -d "${SERVER_DIR}" ]]
then
echo "back ${SERVER_DIR}..."
mv ${SERVER_DIR} ${SERVER_DIR}-back/${SERVER_DIR}-back-"${NOW}"
echo "back success"
fi
echo "copy ${ASSEMBLY_NAME}..."
# 复制到项目同级目录,如果有,则覆盖
cp -r -f ${PROJECT_NAME}/distribution/target/${ASSEMBLY_NAME} ${ASSEMBLY_NAME}
echo "copy success"
pwd
# 5. 运行spring-boot-plus
tar -zxvf ${ASSEMBLY_NAME}
echo "tar.gz decompression success"
pwd
sh ${SERVER_DIR}/bin/shutdown.sh
sh ${SERVER_DIR}/bin/startup.sh
#! /bin/shell
# Copyright 2019-2029 geekidea(https://github.com/geekidea)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#======================================================================
# 使用阿里云镜像
#
# author: geekidea
# date: 2020-3-25
#======================================================================
yum clean all
yum update
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
yum makecache
\ No newline at end of file
#! /bin/shell
# Copyright 2019-2029 geekidea(https://github.com/geekidea)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#======================================================================
# 先下载按照脚本,多次执行该脚本,会覆盖以下下载的文件
# 快速安装jdk/git/maven/redis/mysql
#
# author: geekidea
# date: 2019-8-29
#======================================================================
# 下载脚本
wget -O install-all.sh https://raw.githubusercontent.com/geekidea/spring-boot-plus/master/docs/bin/install/install-all.sh
wget -O install-jdk.sh https://raw.githubusercontent.com/geekidea/spring-boot-plus/master/docs/bin/install/install-jdk.sh
wget -O install-git.sh https://raw.githubusercontent.com/geekidea/spring-boot-plus/master/docs/bin/install/install-git.sh
wget -O install-maven.sh https://raw.githubusercontent.com/geekidea/spring-boot-plus/master/docs/bin/install/install-maven.sh
wget -O install-redis.sh https://raw.githubusercontent.com/geekidea/spring-boot-plus/master/docs/bin/install/install-redis.sh
wget -O install-mysql.sh https://raw.githubusercontent.com/geekidea/spring-boot-plus/master/docs/bin/install/install-mysql.sh
wget -O mysql_spring_boot_plus.sql https://raw.githubusercontent.com/geekidea/spring-boot-plus/master/docs/db/mysql_spring_boot_plus.sql
# 执行安装所有
sh install-all.sh
\ No newline at end of file
#! /bin/shell
# Copyright 2019-2029 geekidea(https://github.com/geekidea)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#======================================================================
# 快速安装jdk/git/maven/redis/mysql
#
# author: geekidea
# date: 2019-8-29
#======================================================================
sh install-jdk.sh
sh install-git.sh
sh install-maven.sh
sh install-redis.sh
sh install-mysql.sh
\ No newline at end of file
#! /bin/shell
# Copyright 2019-2029 geekidea(https://github.com/geekidea)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#======================================================================
# 快速安装GIT
# CentOS7 中已成功验证
# 使用yum方式安装
#
# author: sy
# date: 2019-8-29
#======================================================================
hasGit(){
GIT_VERSION=$(git --version)
echo "${GIT_VERSION}"
if [[ $GIT_VERSION == *version* ]]
then
return 1;
fi
return 0;
}
hasGit
if [ $? != 1 ]
then
echo "Not Found git"
echo "Installing Git..."
yum install -y git
hasGit
if [ $? != 1 ]
then
echo "Install maven Fail"
fi
fi
echo ""
#! /bin/shell
# Copyright 2019-2029 geekidea(https://github.com/geekidea)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#======================================================================
# 快速安装JDK
# CentOS7 中已成功验证
# 使用yum方式安装
#
# author: sy
# date: 2019-8-29
#======================================================================
hasJdk(){
RESULT=$(pgrep java)
if [[ ! $RESULT ]]
then
return 0;
fi
return 1;
}
hasJdk
if [ $? != 1 ]
then
echo "Not Found jdk"
echo "Installing jdk..."
yum install -y java-1.8.0-openjdk
hasJdk
if [ $? != 1 ]
then
echo "Install jdk Fail"
fi
fi
java -version
echo ""
#! /bin/shell
# Copyright 2019-2029 geekidea(https://github.com/geekidea)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#======================================================================
# 快速安装maven shell脚本
#
# author: chenkun
# date: 2019-08-30
#======================================================================
hasMaven(){
MAVEN_VERSION=$(mvn -version)
echo "${MAVEN_VERSION}"
if [[ ! $MAVEN_VERSION ]]
then
return 0;
fi
return 1;
}
hasMaven
if [ $? != 1 ]
then
echo "Not Found maven"
echo "Installing maven..."
# 下载 maven aliyun mirror settings.xml
wget -O settings.xml https://raw.githubusercontent.com/geekidea/spring-boot-plus/master/docs/config/settings.xml
yum install -y maven
hasMaven
if [ $? == 1 ]
then
echo "Config Aliyun Maven Mirror..."
rm -rf /etc/maven/settings.xml
cp settings.xml /etc/maven/
mvn -version
else
echo "Install maven Fail"
fi
fi
echo ""
#! /bin/shell
# Copyright 2019-2029 geekidea(https://github.com/geekidea)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#======================================================================
# 快速安装MySQL
# CentOS7 中已成功验证
# 使用yum+rpm方式安装
#
# author: geekidea
# date: 2019-8-29
#======================================================================
# 下载mysql rpm
wget https://repo.mysql.com//mysql80-community-release-el7-3.noarch.rpm
# 安装rpm
rpm -Uvh mysql80-community-release-el7-3.noarch.rpm
# yum 安装mysql服务
yum install -y mysql-community-server
# 启动mysql服务
systemctl start mysqld.service
# 查看mysql服务状态
systemctl status mysqld.service
# 查看安装的mysql密码
grep 'temporary password' /var/log/mysqld.log
TEMP_PWD=$(grep 'temporary password' /var/log/mysqld.log)
PWD=${TEMP_PWD##* }
echo "${PWD}"
# 登录
mysql -uroot -p${PWD}
# 进入到mysql命令行时,修改密码
# 修改密码
# ALTER USER 'root'@'localhost' IDENTIFIED BY 'Springbootplus666!';
# 使用新密码登录
# exit
# mysql -uroot -pSpringbootplus666!
# 导入spring-boot-plus数据库脚本
# use mysql;
# source /root/Jumeirah.sql;
#! /bin/shell
# Copyright 2019-2029 geekidea(https://github.com/geekidea)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#======================================================================
# 快速安装redis shell脚本
#
# author: chenkun
# date: 2019-08-30
#======================================================================
hasRedis(){
RESULT=$(redis-server -v)
echo "${RESULT}"
if [[ ! $RESULT ]]
then
echo "no"
return 0;
fi
return 1;
}
hasRedis
if [ $? != 1 ]
then
echo "Not Found redis"
echo "Installing redis..."
yum install -y redis
hasRedis
if [ $? != 1 ]
then
echo "Install Redis Fail"
fi
fi
# 设置redis开机启动
systemctl enable redis
# 在后台启动redis服务
systemctl start redis
# 测试redis-cli是否能正常连接,如果输出PONG,则连接成功
redis-cli ping
echo ""
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment