From 245159e1b304d2153f33e04dd1b40ee950bffeb3 Mon Sep 17 00:00:00 2001 From: Elizaveta Morozova Date: Wed, 15 Mar 2023 11:39:54 +0300 Subject: [PATCH] nut-2.8.0-alt-systemd --- scripts/systemd/nut-driver@.service.in | 5 +++-- scripts/systemd/nut-server.service.in | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/scripts/systemd/nut-driver@.service.in b/scripts/systemd/nut-driver@.service.in index 3f1d028d6..cdf9254d7 100644 --- a/scripts/systemd/nut-driver@.service.in +++ b/scripts/systemd/nut-driver@.service.in @@ -38,9 +38,10 @@ PartOf=nut-driver.target # Finally note that "nut-driver-enumerator.service" should take care of this. [Service] -EnvironmentFile=-@CONFPATH@/nut.conf +EnvironmentFile=/etc/sysconfig/upsd SyslogIdentifier=%N -ExecStart=/bin/sh -c 'NUTDEV="`@NUT_LIBEXECDIR@/nut-driver-enumerator.sh --get-device-for-service %i`" && [ -n "$NUTDEV" ] || { echo "FATAL: Could not find a NUT device section for service unit %i" >&2 ; exit 1 ; } ; @SBINDIR@/upsdrvctl start "$NUTDEV"' +ExecStartPre=/bin/cp -p $UPS_CONF ${CHROOTDIR}${UPS_CONF} +ExecStart=/bin/sh -c 'NUTDEV="`@NUT_LIBEXECDIR@/nut-driver-enumerator.sh --get-device-for-service %i`" && [ -n "$NUTDEV" ] || { echo "FATAL: Could not find a NUT device section for service unit %i" >&2 ; exit 1 ; } ; @SBINDIR@/upsdrvctl -u upsdrv -r $CHROOTDIR start "$NUTDEV"' ExecStop=/bin/sh -c 'NUTDEV="`@NUT_LIBEXECDIR@/nut-driver-enumerator.sh --get-device-for-service %i`" && [ -n "$NUTDEV" ] || { echo "FATAL: Could not find a NUT device section for service unit %i" >&2 ; exit 1 ; } ; @SBINDIR@/upsdrvctl stop "$NUTDEV"' # Restart really always, do not stop trying: StartLimitInterval=0 diff --git a/scripts/systemd/nut-server.service.in b/scripts/systemd/nut-server.service.in index 713f5c427..0d2bbf695 100644 --- a/scripts/systemd/nut-server.service.in +++ b/scripts/systemd/nut-server.service.in @@ -18,11 +18,11 @@ Before=nut-monitor.service PartOf=nut.target [Service] -EnvironmentFile=-@CONFPATH@/nut.conf +EnvironmentFile=/etc/sysconfig/upsd SyslogIdentifier=%N # Note: foreground mode by default skips writing a PID file (and # needs Type=simple); can use "-FF" here to create one anyway: -ExecStart=@SBINDIR@/upsd -F +ExecStart=@SBINDIR@/upsd -F -u upsd -r $CHROOTDIR ExecReload=@SBINDIR@/upsd -c reload -P $MAINPID [Install] -- 2.33.5