update
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -22,6 +22,7 @@
|
|||||||
go.work
|
go.work
|
||||||
|
|
||||||
data/
|
data/
|
||||||
|
dist/
|
||||||
venv/
|
venv/
|
||||||
.env
|
.env
|
||||||
.env.example
|
.env.example
|
||||||
|
21
update.sh
21
update.sh
@@ -1,22 +1,25 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
host="root@main"
|
||||||
|
|
||||||
# 更新 go mod, 然後靜態編譯
|
# 更新 go mod, 然後靜態編譯
|
||||||
go mod tidy
|
go mod tidy
|
||||||
go build -o data/main bin/main.go
|
go build -o dist/main bin/main.go
|
||||||
|
|
||||||
# 上传到服务器, 然後刪除本地文件
|
# 上传到服务器, 然後刪除本地文件
|
||||||
scp ./data/main root@47.103.40.152:~/main_new
|
scp dist/main $host:~/webp/main
|
||||||
rm ./data/main
|
rm -rf dist
|
||||||
|
|
||||||
|
# pm2 start /root/webp/main --name webp --watch
|
||||||
|
|
||||||
# 查看 main_ 的進程, 然後使用 kill -9 强制关闭
|
# 查看 main_ 的進程, 然後使用 kill -9 强制关闭
|
||||||
ssh root@47.103.40.152 "ps -ef | grep -v grep | grep ./main"
|
# ssh $host "ps -ef | grep -v grep | grep ./main"
|
||||||
ssh root@47.103.40.152 "kill -9 \`ps -ef | grep -v grep | grep ./main | awk '{print \$2}'\`"
|
# ssh $host "kill -9 \`ps -ef | grep -v grep | grep ./main | awk '{print \$2}'\`"
|
||||||
|
|
||||||
# 重启服务, 保持服务不被关闭 (pkill ./main; 無效, 還需防止 nohup 不退出)
|
# 重启服务, 保持服务不被关闭 (pkill ./main; 無效, 還需防止 nohup 不退出)
|
||||||
ssh root@47.103.40.152 "rm ./main; mv ./main_new ./main;"
|
#ssh $host "rm ./main; mv ./main_new ./main;"
|
||||||
ssh root@47.103.40.152 "nohup ./main test >> nohup.out 2>&1 &"
|
#ssh $host "nohup ./main test >> nohup.out 2>&1 &"
|
||||||
ssh root@47.103.40.152 "nohup ./main server >> nohup.out 2>&1 &"
|
#ssh $host "nohup ./main server >> nohup.out 2>&1 &"
|
||||||
ssh root@47.103.40.152 "ps -ef | grep -v grep | grep ./main"
|
#ssh $host "ps -ef | grep -v grep | grep ./main"
|
||||||
|
|
||||||
# 查看日志
|
# 查看日志
|
||||||
# ssh root@47.103.40.152 "tail -fn 50 nohup.out"
|
# ssh root@47.103.40.152 "tail -fn 50 nohup.out"
|
||||||
|
Reference in New Issue
Block a user