File: nut-sleep.service

package info (click to toggle)
nut 2.8.3-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 24,356 kB
  • sloc: ansic: 123,904; sh: 14,718; cpp: 12,558; makefile: 5,212; python: 1,114; perl: 855; xml: 47
file content (26 lines) | stat: -rw-r--r-- 867 bytes parent folder | download | duplicates (2)
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
# 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/

# A rather blunt solution for system sleeping support, for cases where
# we can not use a native libsystemd "inhibitor interface". This helps
# avoid NUT shutting down a woken-up system just because its power state
# was critical before the sleep, and a next-read timestamp was not seen
# (deemed to be a stale UPS, meaning lost comms during critical state,
# so must go down ASAP).

[Unit]
Description=Network UPS Tools - sleep hook
Before=sleep.target
StopWhenUnneeded=yes

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/bin/systemctl stop nut.target
ExecStop=/usr/bin/systemctl start --no-block nut.target

[Install]
WantedBy=sleep.target