You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
riskshell/shell/updateRisk

46 lines
879 B

4 years ago
#!/bin/sh
4 years ago
#自动部署脚本
4 years ago
cd /app
4 years ago
#服务端端口
4 years ago
export PORT=2233
4 years ago
#客户端访问地址
4 years ago
export webClient=https://risk.kirito.cool
4 years ago
#客户端端口
4 years ago
export serverPort=5000
4 years ago
#客户端监听地址
4 years ago
export listenAddress=0.0.0.0
4 years ago
#服务端访问地址
4 years ago
export apiServer=https://risk.kirito.cool
function run(){
if [ ! -e $1 ]
then
4 years ago
git clone git@gogs.kirito.cool:panqihua/$1.git
4 years ago
isUpdate=1
4 years ago
else
4 years ago
isUpdate=0
4 years ago
fi
cd $1 && git reset --hard && git pull && yarn && chmod +x run.sh && killNode
4 years ago
if [ $isUpdate -eq 0 ]
4 years ago
then
url="http://127.0.0.1:3000/finsh?name=$1"
echo "成功回调地址:$url"
curl $url
fi
4 years ago
}
4 years ago
#检查是否正在部署
4 years ago
result=`ps -ef|grep 'updateRisk $1'|awk 'NR>1{next}{print $1}'`
4 years ago
echo $result
4 years ago
if [ ! -z $result ]
then
4 years ago
echo "检测到自动部署$1进程在运行,直接kill掉"
4 years ago
kill -9 $result
fi
4 years ago
run $1
4 years ago