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
|
# Network UPS Tools (NUT) systemd integration
# Copyright (C) 2011-2025 by NUT contributors
# Distributed under the terms of GPLv2+
# See https://networkupstools.org/
# and https://github.com/networkupstools/nut/
[Unit]
# This unit starts early in system lifecycle to set up nut-driver instances.
# End-user may also restart this unit after editing ups.conf to automatically
# un-register or add new instances as appropriate.
Description=Network UPS Tools - enumeration of configure-file devices into systemd unit instances
Conflicts=nut-driver-enumerator-daemon.service nut-driver-enumerator-daemon-activator.path nut-driver-enumerator-daemon-activator.service
After=local-fs.target
Before=nut-driver.target
PartOf=nut.target
Documentation=man:nut-driver-enumerator(@MAN_SECTION_CMD_SYS@)
Documentation=@NUT_WEBSITE_BASE@/docs/man/nut-driver-enumerator.html
Documentation=man:ups.conf(@MAN_SECTION_CFG@)
Documentation=@NUT_WEBSITE_BASE@/docs/man/ups.conf.html
Documentation=man:upsdrvsvcctl(@MAN_SECTION_CMD_SYS@)
Documentation=@NUT_WEBSITE_BASE@/docs/man/upsdrvsvcctl.html
Documentation=man:nut.conf(@MAN_SECTION_CFG@)
Documentation=@NUT_WEBSITE_BASE@/docs/man/nut.conf.html
[Service]
### Script needs privileges to restart units
#User=@RUN_AS_USER@
#Group=@RUN_AS_GROUP@
User=root
SyslogIdentifier=%N
# it is expected that the process has to exit before systemd starts follow-up
# units; it should not be a problem for those
Type=oneshot
# Currently systemd does not support restarting of oneshot services, and does
# not seem to guarantee that other services would only start after the script
# completes, for a non-oneshot case. The script itself handles restarting of
# nut-server which is the primary concerned dependency at the moment, so we
# don't want it to fail the unit (when it can't restart).
Environment=REPORT_RESTART_42=no
EnvironmentFile=-@CONFPATH@/nut.conf
ExecStartPre=-@SYSTEMD_TMPFILES_PROGRAM@ --create @systemdtmpfilesdir@/nut-common-tmpfiles.conf
ExecStart=@NUT_LIBEXECDIR@/nut-driver-enumerator.sh
ExecReload=@NUT_LIBEXECDIR@/nut-driver-enumerator.sh
[Install]
WantedBy=nut.target
|