30 lines
725 B
Bash
30 lines
725 B
Bash
#!/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 git_hook.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}服务启动成功"
|