Skip to content

Commit

Permalink
apcupsd-service: put UPS in hibernate mode when shutting down
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
bjornfor committed Jul 22, 2013
1 parent d6e5484 commit 95e2006
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions modules/services/monitoring/apcupsd.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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";
};
};

};

}

0 comments on commit 95e2006

Please sign in to comment.