From 557a58af27596eda0f8203017da0d1b28c265196 Mon Sep 17 00:00:00 2001 From: Schwitzz Date: Mon, 2 Nov 2026 14:11:07 -0600 Subject: [PATCH] fix(systemd): set Restart=always and PUBSCRIPT_WEB_DIST in user service and force-restart on .deb install --- desktop/build-deb.sh | 7 ++++--- server/src/index.ts | 5 +++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/desktop/build-deb.sh b/desktop/build-deb.sh index 1c98af0..d64ba86 100755 --- a/desktop/build-deb.sh +++ b/desktop/build-deb.sh @@ -148,9 +148,10 @@ fi if command -v gtk-update-icon-cache >/dev/null 2>&1; then gtk-update-icon-cache -q -t -f /usr/share/icons/hicolor || true fi -# Stop any stale background server from a previous package build so the next -# launch or systemd restart serves the updated /opt/pubscript bundle cleanly. -pkill -f "/opt/pubscript/server/dist/server.mjs" >/dev/null 2>&1 || true +# Stop any stale background server from a previous package build so systemd +# (Restart=on-failure / Restart=always) or the next desktop launch starts the +# freshly installed /opt/pubscript server and asset bundle. +pkill -9 -f "/opt/pubscript/server/dist/server.mjs" >/dev/null 2>&1 || true exit 0 EOF chmod 0755 "$STAGE_DIR/DEBIAN/postinst" diff --git a/server/src/index.ts b/server/src/index.ts index 8ac8a93..a25ca70 100644 --- a/server/src/index.ts +++ b/server/src/index.ts @@ -307,9 +307,10 @@ export async function buildApp() { "Type=simple", `Environment=PORT=${cfg.port}`, `Environment=PUBSCRIPT_DB=${dbFile}`, + "Environment=PUBSCRIPT_WEB_DIST=/opt/pubscript/apps/web/dist", `ExecStart=${existsSync(optServerEntry) ? `/usr/bin/node ${optServerEntry}` : `/usr/bin/node --import tsx ${localServerEntry}`}`, - "Restart=on-failure", - "RestartSec=3", + "Restart=always", + "RestartSec=2", "", "[Install]", "WantedBy=default.target",