Replace detached spawn with mnote-web-prod.service (Restart=always, enable + Linger). prod:start installs the unit, writes env/current symlink, and restarts via systemctl so the gateway survives kills and logout. Also drop unused std::fs import in web_shell.
31 lines
960 B
Desktop File
31 lines
960 B
Desktop File
[Unit]
|
||
Description=MNote web production gateway (user)
|
||
Documentation=file:///mnt/Data1T/mnote/scripts/prod-build-start.js
|
||
After=network-online.target
|
||
Wants=network-online.target
|
||
|
||
[Service]
|
||
Type=simple
|
||
# current 软链由 npm run prod:start 指向最新 release 目录
|
||
WorkingDirectory=/mnt/Data1T/mnote/dist/run/mnote-web-prod/current
|
||
# 生产 env 由 prod-build-start 生成(含 .env.all + bind/control-plane 覆盖)
|
||
EnvironmentFile=-/mnt/Data1T/mnote/dist/run/mnote-web-prod/env
|
||
Environment=RUST_LOG=info
|
||
ExecStart=/mnt/Data1T/mnote/dist/run/mnote-web-prod/current/mnote-web
|
||
# 崩溃/被杀后自动拉起
|
||
Restart=always
|
||
RestartSec=3
|
||
# 优雅退出窗口
|
||
TimeoutStopSec=30
|
||
KillMode=mixed
|
||
# 日志落到 journal;release 目录内 mnote-web.log 仍可由 journalctl 旁路查看
|
||
StandardOutput=journal
|
||
StandardError=journal
|
||
SyslogIdentifier=mnote-web-prod
|
||
|
||
# 轻量资源上限,避免异常 runaway
|
||
LimitNOFILE=65536
|
||
|
||
[Install]
|
||
WantedBy=default.target
|