增加小程序server管理JOB

This commit is contained in:
白茶清欢 2021-11-11 16:53:18 +08:00
commit 09e4c66fa2
2 changed files with 50 additions and 0 deletions

21
.gitignore vendored Normal file
View File

@ -0,0 +1,21 @@
# Created by .ignore support plugin (hsz.mobi)
### Go template
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib
# Test binary, built with `go test -c`
*.test
# Output of the go coverage tool, specifically when used with LiteIDE
*.out
# Dependency directories (remove the comment below to include it)
# vendor/
.idea
.vscode
release
logs

29
publish_mini_server.sh Normal file
View File

@ -0,0 +1,29 @@
#!/usr/bin/env bash
if [ "${PROJECT_PATH}" == "" ]; then
echo "PROJECT_PATH IS NOT FOUND"
# shellcheck disable=SC2242
exit -1
fi
if [ "${CONFIG_PATH}" == "" ]; then
echo "CONFIG_PATH IS NOT FOUND"
# shellcheck disable=SC2242
exit -1
fi
if [ "${APP_ID}" == "" ]; then
echo "APP_ID IS NOT FOUND"
# shellcheck disable=SC2242
exit -1
fi
# 切换到项目目录
# shellcheck disable=SC2164
# shellcheck disable=SC2009
cd "${PROJECT_PATH}" && git pull && go build mini-server.go -o "${APP_ID}" && ps aux | grep "${APP_ID}" | grep -v grep | awk '{print $2}' | xargs kill -9
# 启动服务
nohup "${PROJECT_PATH}"/"${APP_ID}" --config_path="${CONFIG_PATH}" &
echo "${APP_ID}服务启动成功"