forked from mirrors/nixpkgs
apcupsd-service: put UPS in hibernate mode when shutting down
This adds a special systemd service that calls "apcupsd --killpower" (put UPS in hibernate mode) just before shutting down the system. Without this command, the UPS will stay on until the battery is completely empty.
This commit is contained in:
parent
d6e5484e2b
commit
95e2006653
|
@ -156,6 +156,28 @@ in
|
|||
};
|
||||
};
|
||||
|
||||
# A special service to tell the UPS to power down/hibernate just before the
|
||||
# computer shuts down. (The UPS has a built in delay before it actually
|
||||
# shuts off power.) Copied from here:
|
||||
# http://forums.opensuse.org/english/get-technical-help-here/applications/479499-apcupsd-systemd-killpower-issues.html
|
||||
systemd.services.apcupsd-killpower = {
|
||||
after = [ "shutdown.target" ]; # append umount.target?
|
||||
before = [ "final.target" ];
|
||||
wantedBy = [ "shutdown.target" ];
|
||||
unitConfig = {
|
||||
Description = "APC UPS killpower";
|
||||
ConditionPathExists = "/run/apcupsd/powerfail";
|
||||
DefaultDependencies = "no";
|
||||
};
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
ExecStart = "${pkgs.apcupsd}/bin/apcupsd --killpower -f ${configFile}";
|
||||
TimeoutSec = 0;
|
||||
StandardOutput = "tty";
|
||||
RemainAfterExit = "yes";
|
||||
};
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue