From 25660aea77651eb46f0deab8c0e26512a1ec624e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=A7=89?= Date: Mon, 13 Nov 2023 20:47:16 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BF=AB=E9=80=9F=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- update.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/update.sh b/update.sh index 71f0f04..8bcc962 100755 --- a/update.sh +++ b/update.sh @@ -5,10 +5,20 @@ host="root@main" go mod tidy go build -o dist/main bin/main.go +# 重命名旧文件 +ssh $host "mv ~/webp/main ~/webp/main_old" + # 上传到服务器, 然後刪除本地文件 scp dist/main $host:~/webp/main rm -rf dist +# 重载服务 +ssh $host "pm2 reload webp" + +# 删除旧文件 +ssh $host "rm ~/webp/main_old" + + # pm2 start /root/webp/main --name webp --watch # 查看 main_ 的進程, 然後使用 kill -9 强制关闭