From c82e55a5a564ee4328202571b5ae21efbf096a4b Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Mon, 4 May 2026 14:16:32 -0400 Subject: [PATCH] Bug 40901: (follow-up) Fail loudly when koha-sip is enabled without flag file The koha-sip@.service unit gates startup on /var/lib/koha//sip.enabled, the per-instance "I want SIP on" flag file. `koha-sip --enable` creates that flag in the same call that runs `systemctl enable`; running a bare `systemctl enable koha-sip@.service` only flips the systemd half, so the unit ends up enabled-but-refusing-to-start. With ConditionPathExists the failure mode is silent and the unit ends up "enabled" at the systemd level but "Active: inactive" (dead) with "Condition: start condition failed" and the journal logs aren't a big help figuring out the problem. This patch replaces the silent skip with a loud failure with a helpful message: ERROR: SIP not enabled for instance . Use: koha-sip --enable SIPconfig.xml is gated by AssertPathExists if it's missing the unit fails. Either failure path lands the unit in failed state, surfaced by 'systemctl --failed' Signed-off-by: Kyle M Hall Signed-off-by: Martin Renvoize Signed-off-by: Pedro Amorim --- debian/systemd/koha-sip@.service | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/systemd/koha-sip@.service b/debian/systemd/koha-sip@.service index 6071fd2410..6ebca23698 100644 --- a/debian/systemd/koha-sip@.service +++ b/debian/systemd/koha-sip@.service @@ -3,8 +3,7 @@ Description=Koha SIP server for %i PartOf=koha@%i.target Requires=koha-create-dirs@%i.service After=koha@%i.target -ConditionPathExists=/var/lib/koha/%i/sip.enabled -ConditionPathExists=/etc/koha/sites/%i/SIPconfig.xml +AssertPathExists=/etc/koha/sites/%i/SIPconfig.xml [Service] Type=simple @@ -14,6 +13,7 @@ WorkingDirectory=/var/lib/koha/%i Environment=KOHA_CONF=/etc/koha/sites/%i/koha-conf.xml Environment=KOHA_HOME=/usr/share/koha Environment=PERL5LIB=/usr/share/koha/lib +ExecStartPre=+/bin/sh -c 'test -e /var/lib/koha/%i/sip.enabled || { echo "ERROR: SIP not enabled for instance %i. Use: koha-sip --enable %i" >&2; exit 1; }' ExecStart=/usr/bin/perl /usr/share/koha/lib/C4/SIP/SIPServer.pm /etc/koha/sites/%i/SIPconfig.xml Restart=on-failure RestartSec=30s