From 67387be19228a67c30aa30d0b679c7c5b5a10437 Mon Sep 17 00:00:00 2001 From: eson <9673575+githubcontent@user.noreply.gitee.com> Date: Mon, 13 Nov 2023 17:52:02 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0gateway?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- go.mod | 2 +- go.sum | 4 ++-- proto | 2 +- protoc.sh | 33 +------------------------------ run_gateway_latest.sh | 46 +++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 51 insertions(+), 36 deletions(-) create mode 100755 run_gateway_latest.sh diff --git a/go.mod b/go.mod index d5bbb3a..5b8b9fc 100644 --- a/go.mod +++ b/go.mod @@ -47,4 +47,4 @@ require ( gopkg.in/yaml.v3 v3.0.1 // indirect ) -replace fusen-basic v0.0.0 => gitee.com/fusenpack/fusen-basic v0.0.5-0.20231109042013-6235d097ca40 +replace fusen-basic v0.0.0 => gitee.com/fusenpack/fusen-basic v0.0.5-0.20231109081455-017a4a27ebc6 diff --git a/go.sum b/go.sum index a425ee4..caa3f64 100644 --- a/go.sum +++ b/go.sum @@ -1,6 +1,6 @@ dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= -gitee.com/fusenpack/fusen-basic v0.0.5-0.20231109042013-6235d097ca40 h1:Ab4+L6M36S2ZIjSh2gpStnpL6d2qP5dcPLssxgBTw9E= -gitee.com/fusenpack/fusen-basic v0.0.5-0.20231109042013-6235d097ca40/go.mod h1:VTOMNVbG/jJBGUinI+/pn8MPsbkN7+gwk2DP8vncTkA= +gitee.com/fusenpack/fusen-basic v0.0.5-0.20231109081455-017a4a27ebc6 h1:EfC/otGhF2/ghnIQeoolOY+KtvHryPtwBD4uyCWJxtU= +gitee.com/fusenpack/fusen-basic v0.0.5-0.20231109081455-017a4a27ebc6/go.mod h1:VTOMNVbG/jJBGUinI+/pn8MPsbkN7+gwk2DP8vncTkA= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/HdrHistogram/hdrhistogram-go v1.1.2/go.mod h1:yDgFjdqOqDEKOvasDdhWNXYg9BVp4O+o5f6V/ehm6Oo= github.com/ajstarks/svgo v0.0.0-20180226025133-644b8db467af/go.mod h1:K08gAheRH3/J6wwsYMMT4xOr94bZjxIelGM0+d/wbFw= diff --git a/proto b/proto index f05c723..6616d01 160000 --- a/proto +++ b/proto @@ -1 +1 @@ -Subproject commit f05c723d4dea13224cdd9dcbfeb9ed8c9a59da35 +Subproject commit 6616d01aac4a969d7b260733de3673b9ee15470a diff --git a/protoc.sh b/protoc.sh index 1ae8540..8cb5c9b 100755 --- a/protoc.sh +++ b/protoc.sh @@ -10,35 +10,4 @@ cd $script_dir/proto git pull origin master cd $script_dir go run -gcflags="-N" proto/goutils/proto_build/main.go gateway - -run_server() { - server_name="server" - gateway_name="grpc-gateway" - - # 导航到相应的目录 - cd $script_dir/server - echo "build $gateway_name" - go build - - # 如果之前存在相同名字的 screen 会话,先将其终止 - # 首先尝试关闭已存在的screen会话 - existing_session=$(screen -ls | grep -w "$gateway_name") - if [ -n "$existing_session" ]; then - echo "Terminating existing screen session for $gateway_name" - screen -S "$gateway_name" -X quit - while [[ $(screen -ls | grep "\.$gateway_name\s") ]]; do - sleep 0.1s # 等待0.1秒后再次检查 - echo "wait for $gateway_name" - done - fi - - # 循环检查screen进程是否存在 - - [ -f .gitignore ] || (echo "server" > .gitignore && echo "main" >> .gitignore) - # 使用 screen 运行 go run .go - - echo "Running $gateway_name" - screen -dmS $gateway_name -L ./$server_name -} - -run_server \ No newline at end of file + \ No newline at end of file diff --git a/run_gateway_latest.sh b/run_gateway_latest.sh new file mode 100755 index 0000000..318ddb2 --- /dev/null +++ b/run_gateway_latest.sh @@ -0,0 +1,46 @@ +#! /bin/bash + +./update_fspkg_master.sh + +# 获取当前脚本的全局路径 +script_path=$(realpath "$0") + +# 获取当前脚本的目录 +script_dir=$(dirname "$script_path") + +cd $script_dir/proto +git pull origin master +cd $script_dir +go run -gcflags="-N" proto/goutils/proto_build/main.go gateway + +run_server() { + server_name="server" + gateway_name="grpc-gateway" + + # 导航到相应的目录 + cd $script_dir/server + echo "build $gateway_name" + go build + + # 如果之前存在相同名字的 screen 会话,先将其终止 + # 首先尝试关闭已存在的screen会话 + existing_session=$(screen -ls | grep -w "$gateway_name") + if [ -n "$existing_session" ]; then + echo "Terminating existing screen session for $gateway_name" + screen -S "$gateway_name" -X quit + while [[ $(screen -ls | grep "\.$gateway_name\s") ]]; do + sleep 0.1s # 等待0.1秒后再次检查 + echo "wait for $gateway_name" + done + fi + + # 循环检查screen进程是否存在 + + [ -f .gitignore ] || (echo "server" > .gitignore && echo "main" >> .gitignore) + # 使用 screen 运行 go run .go + + echo "Running $gateway_name" + screen -dmS $gateway_name -L ./$server_name +} + +run_server \ No newline at end of file