1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
|
# Network UPS Tools (NUT) systemd integration
# Copyright (C) 2011-2023 by NUT contirbutors
# Distributed under the terms of GPLv2+
# See https://networkupstools.org/
# and https://github.com/networkupstools/nut/
[Unit]
Description=Network UPS Tools - power devices information server
After=local-fs.target network.target nut-driver.target
# We don't Require drivers to be successfully started! This would be
# a change of behavior compared to init SysV, and could prevent from
# accessing successfully started, at least to audit a system.
Wants=nut-driver.target
# The `upsd` is a networked service (even if bound to a `localhost`)
# so it requires that the OS has some notion of networking already.
# Extending the unit does not require *this* file to be edited, you
# can instead drop in an additional piece of configuration, e.g. to
# require that NUT data server only starts after external networking
# is configured (usable IP addresses appear in the system) you can
# add a `/etc/systemd/system/nut-server.service.d/network.conf` with:
# [Unit]
# Requires=network-online.target
# After=network-online.target
Requires=network.target
Before=nut-monitor.service
PartOf=nut.target
[Service]
EnvironmentFile=-@CONFPATH@/nut.conf
SyslogIdentifier=%N
# Note: foreground mode "-F" by default skips writing a PID file (and
# needs default Type=simple); we can use "-FF" here to create the file
# anyway, so that old "upsd -c reload" works rather than systemd action:
ExecStartPre=-@SYSTEMD_TMPFILES_PROGRAM@ --create @systemdtmpfilesdir@/nut-common-tmpfiles.conf
ExecStart=@SBINDIR@/upsd @SYSTEMD_DAEMON_ARGS_UPSD@
ExecReload=@SBINDIR@/upsd -c reload -P $MAINPID
# No tracking for PIDFile path and service attribute here (it might not
# even exist).
# If "-FF" or background-daemon mode is used, so that PID file exists
# and "upsd -c stop" in particular can be used from command-line or
# legacy scripts, it causes a clean and intentional exit of the daemon.
# Then systemd should not revive it - hence restart it only on failure:
Restart=on-failure
Type=@SYSTEMD_DAEMON_TYPE_UPSD@
@SYSTEMD_DAEMON_WATCHDOG_UPSD@
@SYSTEMD_DAEMON_NOTIFYACCESS_UPSD@
[Install]
WantedBy=nut.target
Alias=upsd.service
|