发布脚本

This commit is contained in:
2026-09-23 21:51:11 +08:00
parent 0db8087765
commit 1c5df7abbb
+9 -27
View File
@@ -1,34 +1,16 @@
#!/bin/bash #!/bin/bash
FILE_NAME="web_cgdj_h5"
REMOTE_FILE_PATH="/home/server2/web_cgdj/h5/"
TAG_NAME="web_cgdj_h5.tar.gz"
set -e
set -o
function send_msg() {
msg="@jscdsndj @xiuyuan_Lee @steven0yu %0A服务:SERVER2  站点-cgdj-H5 %0A更新内容:$content%0A创建时间: $(date +%F_%X)%0A操作人:$(git config user.name)"
curl -X POST "https://api.telegram.org/bot6357085965:AAEmXfjZnZwnDTicL7Wjbd7cXvYv_G98w8A/sendMessage" -d "chat_id=$1&text=$msg" >/dev/null 2>&1
}
read -p "输入yes, 开始上传: " word
if [[ ! "yes" =~ $word ]]; then
echo "终止"
else
read -e -p "本次更新内容(输入q退出编辑): " -r content
echo "开始" echo "开始"
rm -rf ./$FILE_NAME ./$TAG_NAME ./yinsemd5.txt rm -rf ./web_huangguo_h5 ./web_huangguo_h5.tar.gz
GOOS=linux GOARCH=amd64 go build -o $FILE_NAME GOOS=linux GOARCH=amd64 go build -o web_huangguo_h5
md5sum $FILE_NAME | cut -d ' ' -f1 >yinsemd5.txt tar zvcf web_huangguo_h5.tar.gz web_huangguo_h5 templates/ static/ \
# 排除 app 定时生成的 SEO 静态文件,避免覆盖服务器上已有 sitemap/rss/llms
tar zvcf $TAG_NAME ./$FILE_NAME templates/ static/ yinsemd5.txt \
--exclude='templates/page/sitemaps/sitemap.xml' \ --exclude='templates/page/sitemaps/sitemap.xml' \
--exclude='templates/page/sitemaps/sitemap-*.xml' \ --exclude='templates/page/sitemaps/sitemap-*.xml' \
--exclude='templates/page/rss.xml' \ --exclude='templates/page/rss.xml' \
--exclude='templates/page/llms.txt' \ --exclude='templates/page/llms.txt' \
--exclude='templates/page/llms-full.txt' --exclude='templates/page/llms-full.txt'
md5sum $TAG_NAME | cut -d ' ' -f1 >yinsemd5.txt
scp -i ~/.ssh/id_rsa -P 22889 ./yinsemd5.txt server2@116.212.120.2:$REMOTE_FILE_PATH
scp -i ~/.ssh/id_rsa -P 22889 ./$TAG_NAME server2@116.212.120.2:$REMOTE_FILE_PATH scp web_huangguo_h5.tar.gz root@172.104.166.87:/data/uzip
send_msg -4791758991 #服务器小组 ssh root@172.104.166.87 "/server/web_huangguo/h5/up_app.sh"
fi
rm -rf ./$FILE_NAME ./$TAG_NAME ./yinsemd5.txt rm -rf ./web_huangguo_h5 ./web_huangguo_h5.tar.gz