加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
deploy.sh 1.41 KB
一键复制 编辑 原始数据 按行查看 历史
Aron 提交于 2019-05-10 12:32 . :bug:启动脚本
#!/bin/bash
# 参数说明
# $1 jarName 默认 ifast-1.0.0.jar
# $2 branch 默认 dev
# $3 appDir 默认 /home/server/webapps/ifast
# $4 profile 激活的配置文件,默认dev
#
# step 1.
#
# $1
# jar名称默认
jarName=$1
if [ -z "${jarName}" ]
then
jarName=ifast-1.0.0.jar
fi
echo "jarName: ${jarName}"
# $2
# 将指定分支最新代码部署到指定目录。默认dev
# 如果目录不存在会自动创建。
branch=$2
if [ -z "${branch}" ]
then
branch=dev
fi
echo "branch: ${branch}"
# $3
appDir=$3
if [ -z "${appDir}" ]
then
appDir=/home/server/webapps/ifast
fi
if [ ! -d ${appDir} ]
then
echo "目录 ${appDir} 不存在,尝试创建 ..."
mkdir -p ${appDir}
fi
echo "appDir: ${appDir}"
# $4
profile=$4
if [ -z "${profile}" ]
then
profile=dev
fi
echo "profile: ${profile}"
#
# step 2.
#
srcDir=`pwd`
git pull origin ${branch}
mvn install
#
# step 3. shutdown > delete | backup
#
cd ${appDir}
echo "shutdown ..."
if [ -d "bin" ]
then
cd bin
./shutdown.sh ${jarName}
ps -ef | grep ${jarName}
cd ..
fi
echo "del ${appDir}/${jarName}"
rm -f ${jarName}
echo "del ${appDir}/bin"
rm -rf bin
# move | copy > chmod
echo "move ${srcDir}/target/${jarName} to ${appDir}"
mv ${srcDir}/target/${jarName} ${appDir}
echo "copy dir ${srcDir}/bin to `pwd`"
cp -R ${srcDir}/bin .
chmod u+x ${appDir}/bin/*
#
# step 4. start
#
echo "startup ..."
cd bin
./startup.sh ${jarName} ${profile}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化