2 Star 1 Fork 1

好未来技术团队/gaea

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
deploy.sh 2.18 KB
一键复制 编辑 原始数据 按行查看 历史
wuwenke 提交于 2020-08-02 17:22 +08:00 . init
#!/bin/bash
# Deployment script
# There are three parameters
# $1: your project dir name
# $2: the compiled executable file name
# $3: the environment your app run on, Mainly used to load configuration files according to the environment
# usage: sh /path_to_gaea/deploy.sh gaea gaea $env
#Configure according to actual situation
supervisorConfDir="/etc/supervisor"
appDir="/home/www"
projectname=$1
servicename=$2
environment=$3
if [ x"$projectname" = x ]; then
echo "projectname param err"
exit 1
fi
if [ x"$servicename" = x ]; then
echo "service param err"
exit 1
fi
if [ x"$environment" = x ]; then
echo "not found env param"
else
env_file="${appDir}/$1/conf/conf_${environment}.ini"
if [ ! -f "$env_file" ]; then
echo "$env_file config not found"
exit 1
fi
conf_file="${appDir}/$1/conf/conf.ini"
cp -f ${env_file} ${conf_file}
fi
function runserver(){
project=$1
service=$2
useSignal=$3
supervisorini="${supervisorConfDir}/${service}.ini"
projectini="${appDir}/${project}/conf/${service}.ini"
if [ ! -f "$projectini" ]; then
echo "$projectini config not found"
return
fi
if [ ! -f "$supervisorini" ]; then
cp -f ${projectini} ${supervisorini}
supervisorctl update
return
else
checksum=`md5sum "${supervisorini}" | cut -d " " -f1`
checksum1=`md5sum "${projectini}" | cut -d " " -f1`
echo ${checksum}
echo ${checksum1}
if [ "$checksum" = "$checksum1" ]; then
echo "ini not change"
else
echo "ini change"
cp -f ${projectini} ${supervisorini}
supervisorctl update
#restart server when conf.ini is changed
supervisorctl restart ${service}
return
fi
fi
serviceStatus=`supervisorctl status ${service} | awk '{print $2}'`
if [ "$useSignal" == "0" ]; then
supervisorctl restart ${service}
else
if [ "$serviceStatus" != "RUNNING" ]; then
supervisorctl restart ${service}
else
supervisorctl signal SIGUSR2 ${service}
fi
fi
}
runserver ${projectname} ${servicename} 1
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/ta-tech-team/gaea.git
git@gitee.com:ta-tech-team/gaea.git
ta-tech-team
gaea
gaea
master

搜索帮助