From 5c4dae4f10fe5f4b9c04a785fff293da622cd8db Mon Sep 17 00:00:00 2001 From: smail Date: Sat, 17 Oct 2026 00:09:14 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E9=83=A8=E7=BD=B2=E8=84=9A?= =?UTF-8?q?=E6=9C=AC=EF=BC=9A=E6=8E=88=E6=9D=83=E5=AE=89=E8=A3=85=E7=9B=AE?= =?UTF-8?q?=E5=BD=95=E7=BB=99smail=E7=94=A8=E6=88=B7=E5=B9=B6=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E5=90=AF=E5=8A=A8=E6=9C=8D=E5=8A=A1=E6=89=93=E5=8D=B0?= =?UTF-8?q?=E8=BF=90=E8=A1=8C=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- deploy/install-systemd.sh | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/deploy/install-systemd.sh b/deploy/install-systemd.sh index 13ac2441..5b58be63 100644 --- a/deploy/install-systemd.sh +++ b/deploy/install-systemd.sh @@ -162,7 +162,8 @@ if ! getent group smail >/dev/null; then groupadd --system smail; fi if ! getent passwd smail >/dev/null; then useradd --system --gid smail --home-dir "$runtime_dir" --shell /usr/sbin/nologin smail; fi if ! getent group smail-plugin >/dev/null; then groupadd --system smail-plugin; fi if ! getent passwd smail-plugin >/dev/null; then useradd --system --gid smail-plugin --home-dir /nonexistent --shell /usr/sbin/nologin smail-plugin; fi -install -d -o root -g root -m 0755 "$runtime_dir" +install -d -o smail -g smail -m 0755 "$runtime_dir" +chown smail:smail "$runtime_dir" install -d -o root -g root -m 0750 /etc/smail if [ ! -e /etc/smail/smail.env ]; then # 每次部署都重新创建服务环境文件,不继承旧的凭据或代理配置。 @@ -229,9 +230,18 @@ chmod 0644 /etc/systemd/system/smail-admin.service chown root:root /etc/systemd/system/smail-admin.service systemctl daemon-reload systemctl enable smail -# 清理旧版本可能留下的开机启动关系。smail-admin 单元没有 [Install],不能再次 enable。 systemctl disable smail-admin >/dev/null 2>&1 || true -echo "配置、数据库、证书、日志、插件和绑定信息均未继承;请先完成初始化配置,再使用 systemctl start smail 启动。" -echo "smail-admin 仅允许按需执行 start/stop,不支持开机自启动。" -echo "主服务默认内存高水位 384 MiB、硬上限 512 MiB;不是容量承诺,请先核对同机资源预算。" -echo "旧环境文件不会自动补写 GOMEMLIMIT;启动后请按《生产资源部署说明》执行只读资源预检。" + +echo "=== 正在启动 Smail 系统服务 ===" +systemctl restart smail + +echo "=== Smail 服务状态 ===" +systemctl status smail --no-pager || true + +echo "==========================================================" +echo " Smail 安装与系统服务注册完成!" +echo " 安装路径: $runtime_dir" +echo " 运行用户: smail" +echo " 开机自启: 已启用 (systemctl enable smail)" +echo " 服务状态: 已启动 (systemctl status smail)" +echo "=========================================================="