diff --git a/bin/main.go b/bin/main.go index acb536a..347526d 100644 --- a/bin/main.go +++ b/bin/main.go @@ -34,7 +34,7 @@ func stringToInt(str string, defaultValue int) int { func LogComponent(startTime int64, r *http.Request) { endTime := fmt.Sprintf("%dms", (time.Now().UnixNano()-startTime)/1000000) - log.Println(r.Method, r.URL.Path, endTime) + log.Println(r.Method, r.URL, endTime) } type User struct { diff --git a/update.sh b/update.sh index 1d03c30..ca9484e 100755 --- a/update.sh +++ b/update.sh @@ -7,7 +7,7 @@ go mod tidy go build -o data/main bin/main.go # 上传到服务器 -scp ./data/main root@47.103.40.152:~/main +scp ./data/main root@47.103.40.152:~/main_new # 刪除本地文件 rm ./data/main @@ -16,12 +16,13 @@ rm ./data/main ssh root@47.103.40.152 "ps -ef | grep -v grep | grep ./main" # 重启服务, 保持服务不被关闭 -ssh root@47.103.40.152 "pkill './main test'; nohup ./main test &" -ssh root@47.103.40.152 "pkill './main server'; nohup ./main server &" +ssh root@47.103.40.152 "pkill './main test'; pkill './main server'; rm ./main; mv ./main_new ./main;" +ssh root@47.103.40.152 "nohup ./main test &" +ssh root@47.103.40.152 "nohup ./main server &" ssh root@47.103.40.152 "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" # 查看所有進程, 排除grep, 只看本用戶, 排除進程名帶方括號的, 排除lib, 排除bash, 排除sshd, 按照進程名排序, 對 main 高亮爲紅色 #ssh root@47.103.40.152 "ps -ef | grep -v grep | grep \$USER | grep -v '\[' | grep -v /lib | grep -v bash | grep -v sshd | grep -v /sbin | sort -k 8"