加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
deploy.sh 1.69 KB
一键复制 编辑 原始数据 按行查看 历史
苗永宾 提交于 2022-03-09 19:22 . first commit
#!/bin/sh
set -x
module=$1
version=$2
dist=zeus_web_$(date +%Y%m%d)_${version}
pack(){
ssh root@sh1-int-static-arch-dom-web-prod-1 \
'cd /data/deploy_code/zeus-web;git pull;npm run build:prod;cd dist;tar -zcf '"${dist}"'.tar.gz *;mv '"${dist}"'.tar.gz /data/deploy_package/'
}
push(){
ssh root@sh1-int-static-arch-dom-web-prod-1 \
'scp -o StrictHostKeyChecking=no /data/deploy_package/'"${dist}.tar.gz"' root@sh1-int-static-arch-zeus-web-prod-1:/data/deploy_package/;' \
'scp -o StrictHostKeyChecking=no /data/deploy_package/'"${dist}.tar.gz"' root@sh1-int-static-arch-zeus-web-prod-2:/data/deploy_package/;' \
'scp -o StrictHostKeyChecking=no /data/deploy_package/'"${dist}.tar.gz"' root@tx1-int-static-arch-zeus-web-prod-1:/data/deploy_package/;' \
'scp -o StrictHostKeyChecking=no /data/deploy_package/'"${dist}.tar.gz"' root@tx1-int-static-arch-zeus-web-prod-2:/data/deploy_package/;'
}
unzip(){
ssh root@sh1-int-static-arch-zeus-web-prod-1 'cd /usr/local/nginx/ROOT_WEB; rm -rf static;tar -xvf /data/deploy_package/'${dist}.tar.gz
ssh root@sh1-int-static-arch-zeus-web-prod-2 'cd /usr/local/nginx/ROOT_WEB; rm -rf static;tar -xvf /data/deploy_package/'${dist}.tar.gz
ssh root@tx1-int-static-arch-zeus-web-prod-1 'cd /usr/local/nginx/ROOT_WEB; rm -rf static;tar -xvf /data/deploy_package/'${dist}.tar.gz
ssh root@tx1-int-static-arch-zeus-web-prod-2 'cd /usr/local/nginx/ROOT_WEB; rm -rf static;tar -xvf /data/deploy_package/'${dist}.tar.gz
}
if [ "${module}" = "pack" ];then
pack $;
elif [ "${module}" = "push" ];then
push $;
elif [ "${module}" = "unzip" ];then
unzip $;
elif [ "${module}" = "deploy" ];then
pack $;
push $;
unzip $;
else echo "please input the right module."
fi
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化