From eb26f6e3f2f547f68c013fee757150c9c4982220 Mon Sep 17 00:00:00 2001 From: woon Date: Fri, 10 Mar 2023 11:44:49 +0800 Subject: [PATCH] update --- app.service.example | 2 +- build.sh | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/app.service.example b/app.service.example index 3f007a0..973f923 100644 --- a/app.service.example +++ b/app.service.example @@ -3,7 +3,7 @@ Description=gin-article Application After=network.target [Service] -User=root +User=app WorkingDirectory=APP_PATH ExecStart=APP_PATH/app >> APP_PATH/app.log 2>&1 Restart=always diff --git a/build.sh b/build.sh index 46c0c9b..0419954 100644 --- a/build.sh +++ b/build.sh @@ -1,5 +1,14 @@ #!/bin/bash +# 判断 app 用户是否存在 +if id "app" >/dev/null 2>&1; then + echo "User app exists." +else + # 创建 app 用户 + echo "Creating user app..." + useradd -m -s /bin/bash app +fi + app_name=gin-article # 获取当前目录的绝对路径