Files
2026-11-07 10:47:32 +08:00

28 lines
1.2 KiB
Bash
Executable File
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/bash
FILE_NAME="web_mdcom_web"
REMOTE_FILE_PATH="/home/server2/web_mdcom/web/"
TAG_NAME="web_mdcom_web.tar.gz"
set -e
set -o
function send_msg() {
msg="@jscdsndj @xiuyuan_Lee @steven0yu %0A服务:SERVER2  站点-91spz.com管理服务(WEB)%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 "开始"
rm -rf ./$FILE_NAME ./$TAG_NAME ./yinsemd5.txt
GOOS=linux GOARCH=amd64 go build -o $FILE_NAME
md5sum $FILE_NAME | cut -d ' ' -f1 >yinsemd5.txt
tar zvcf $TAG_NAME ./$FILE_NAME yinsemd5.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
send_msg -4791758991 #服务器小组
fi
rm -rf ./$FILE_NAME ./$TAG_NAME ./yinsemd5.txt