From e262fc871961ba9187d8510ee1ca977523536090 Mon Sep 17 00:00:00 2001 From: woon Date: Fri, 10 Mar 2023 11:42:12 +0800 Subject: [PATCH] update --- app.service => app.service.example | 0 build.sh | 8 +++++--- 2 files changed, 5 insertions(+), 3 deletions(-) rename app.service => app.service.example (100%) diff --git a/app.service b/app.service.example similarity index 100% rename from app.service rename to app.service.example diff --git a/build.sh b/build.sh index 78d8d33..46c0c9b 100644 --- a/build.sh +++ b/build.sh @@ -11,10 +11,12 @@ cd ${app_path} && git pull # 执行 go build 命令 cd ${app_path} && go build -o app -# 替换 app.service 文件中的 APP_PATH -sed -i "s|APP_PATH|${app_path}|g" app.service +cp app.service.example ${app_name}.service -cp app.service /etc/systemd/system/${app_name}.service +# 替换 app.service 文件中的 APP_PATH +sed -i "s|APP_PATH|${app_path}|g" ${app_name}.service + +mv ${app_name}.service /etc/systemd/system/${app_name}.service # 重新加载 systemd 配置文件 systemctl daemon-reload