From e8631a0e1013a9829ac719bda8343652aa72bb26 Mon Sep 17 00:00:00 2001 From: dekun Date: Tue, 16 Jun 2026 09:06:47 +0800 Subject: [PATCH] fix: generate share links before acme reloadcmd registration Avoid script exit when acme reloadcmd fails transiently on systemd dbus. Co-authored-by: Cursor --- scripts/finish-install.sh | 11 ++++++----- scripts/install.sh | 3 ++- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/scripts/finish-install.sh b/scripts/finish-install.sh index d552e20..0eb61ed 100644 --- a/scripts/finish-install.sh +++ b/scripts/finish-install.sh @@ -65,11 +65,6 @@ systemctl daemon-reload systemctl enable sing-box systemctl restart sing-box -/root/.acme.sh/acme.sh --install-cert -d "$DOMAIN" \ - --key-file /etc/sing-box/certs/privkey.pem \ - --fullchain-file /etc/sing-box/certs/fullchain.pem \ - --reloadcmd "systemctl restart sing-box" - CLIENT_DIR="${ROOT_DIR}/client/generated" mkdir -p "$CLIENT_DIR" sed -e "s|\${VPS_IP}|${VPS_IP}|g" \ @@ -89,6 +84,12 @@ vless://${UUID}@${VPS_IP}:443?encryption=none&flow=xtls-rprx-vision&security=rea hy2://${HY2_PASSWORD}@${DOMAIN}:8443?sni=${DOMAIN}#Hysteria2-Backup EOF +/root/.acme.sh/acme.sh --install-cert -d "$DOMAIN" \ + --key-file /etc/sing-box/certs/privkey.pem \ + --fullchain-file /etc/sing-box/certs/fullchain.pem \ + --reloadcmd "systemctl restart sing-box" \ + || echo "警告: acme reloadcmd 注册失败,sing-box 已在运行,可忽略" + echo "" echo "完成!sing-box 状态:" systemctl status sing-box --no-pager diff --git a/scripts/install.sh b/scripts/install.sh index ea80e23..fc2fa2a 100644 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -143,7 +143,8 @@ log "注册证书续期 reload 命令 ..." /root/.acme.sh/acme.sh --install-cert -d "$DOMAIN" \ --key-file /etc/sing-box/certs/privkey.pem \ --fullchain-file /etc/sing-box/certs/fullchain.pem \ - --reloadcmd "systemctl restart sing-box" + --reloadcmd "systemctl restart sing-box" \ + || log "acme reloadcmd 注册失败,可忽略(服务已配置)" systemctl restart sing-box