From d0b7ed3245b38e439e56255b6cd621867ad36e36 Mon Sep 17 00:00:00 2001 From: cnbugs <717192502@qq.com> Date: Wed, 13 May 2026 12:05:40 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dservice=E7=A1=AC=E7=BC=96?= =?UTF-8?q?=E7=A0=81=E8=B7=AF=E5=BE=84=E9=97=AE=E9=A2=98=EF=BC=9A=E5=8A=A8?= =?UTF-8?q?=E6=80=81=E6=9B=BF=E6=8D=A2=E9=83=A8=E7=BD=B2=E8=B7=AF=E5=BE=84?= =?UTF-8?q?=EF=BC=8C=E6=94=AF=E6=8C=81=E4=BB=BB=E6=84=8F=E7=9B=AE=E5=BD=95?= =?UTF-8?q?=E9=83=A8=E7=BD=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- autossl.service | 4 ++-- deploy.sh | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/autossl.service b/autossl.service index f3afa99..942d8a9 100644 --- a/autossl.service +++ b/autossl.service @@ -6,11 +6,11 @@ Wants=network.target [Service] Type=simple User=root -WorkingDirectory=/root/auto-ssl/backend +WorkingDirectory={{DEPLOY_DIR}}/backend Environment="PORT=9090" Environment="ACME_PORT=8082" Environment="GIN_MODE=release" -ExecStart=/root/auto-ssl/backend/autossl +ExecStart={{DEPLOY_DIR}}/backend/autossl Restart=always RestartSec=3 StandardOutput=journal+console diff --git a/deploy.sh b/deploy.sh index 9f51b4e..d340467 100755 --- a/deploy.sh +++ b/deploy.sh @@ -28,7 +28,9 @@ cp -rf frontend/dist/* backend/dist/ # 5. 创建systemd服务 echo "5. 安装systemd服务..." -sudo cp autossl.service /etc/systemd/system/ +# 动态替换部署路径 +sed "s|{{DEPLOY_DIR}}|$PWD|g" autossl.service > /tmp/autossl.service +sudo cp /tmp/autossl.service /etc/systemd/system/autossl.service sudo systemctl daemon-reload sudo systemctl enable autossl