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

43 lines
711 B

4 years ago
#!/bin/sh
4 years ago
#自动部署脚本
4 years ago
4 years ago
#如果当前存在自动部署进程直接kill掉
4 years ago
if [ -e $1.pid ]
4 years ago
then
4 years ago
kill -9 `cat $1.pid`
if [ $? -eq 0 ]
then
echo "成功杀死进程:$pid"
rm -f $file
fi
4 years ago
fi
4 years ago
echo $$>$1.pid
4 years ago
cd /app
4 years ago
source riskenv
4 years ago
function run(){
if [ ! -e $1 ]
then
4 years ago
git clone git@gogs.kirito.cool:panqihua/$1.git
4 years ago
isUpdate=0
else
isUpdate=1
4 years ago
fi
cd $1 && git reset --hard && git pull && yarn && chmod +x run.sh && killNode
4 years ago
if [ $isUpdate -eq 1 ]
then
4 years ago
url="http://127.0.0.1:3000/finsh"
4 years ago
echo "成功回调地址:$url"
4 years ago
curl -X POST -d "{'name':'$1'}" $url
4 years ago
fi
4 years ago
}
4 years ago
run $1
4 years ago
echo `pwd`
4 years ago
rm -f ../$1.pid
4 years ago
echo "脚本运行完毕,删除$1.pid"