Uninterruptible power supply: Difference between revisions

Tie-ling (talk | contribs)
Delay UPS Shutdown: fix attrset
Wo2wz (talk | contribs)
remove unnecessary portion under compatible hardware
 
(2 intermediate revisions by 2 users not shown)
Line 25: Line 25:
needs a new battery every four years, under optimal operating
needs a new battery every four years, under optimal operating
conditions.
conditions.
The end of ConfigExample book says:
Joe's server will still be allright
if power drops off in the night.
  That 8 year old pack
  of battery backup
will easily handle th connection lost


= Components of NUT Software =
= Components of NUT Software =
Line 246: Line 238:
   # copied from ConfigExamples 3.0 book, Appendix B.2.
   # copied from ConfigExamples 3.0 book, Appendix B.2.
   systemd.services.nut-delayed-ups-shutdown = {
   systemd.services.nut-delayed-ups-shutdown = {
     environment = config.systemd.services.upsd.environment;
    enable = true;
     unitConfig = {
     environment = config.systemd.services.upsmon.environment;
      Description = "Initiate delayed UPS shutdown";
     description = "Initiate delayed UPS shutdown";
      Before = "umount.target";
    before = [ "umount.target" ];
      DefaultDependencies = false;
    wantedBy = [ "final.target" ];
    };
     serviceConfig = {
     serviceConfig = {
       Type = "oneshot";
       Type = "oneshot";
       ExecStart = ''${pkgs.bash}/bin/bash -c\
      # need to use '-u root', or else permission denied
      "${pkgs.util-linux}/bin/logger -t\
       ExecStart = ''${pkgs.nut}/bin/upsdrvctl -u root shutdown'';
        nut-delayed-ups-shutdown 'upsdrvctl shutting down UPS';\
      # must not use slice: if used, upsdrvctl will not run as a late
        ${pkgs.nut}/bin/upsdrvctl shutdown"'';
      # shutdown service
      # Slice = "";
    };
    unitConfig = {
      ConditionPathExists = config.power.ups.upsmon.settings.POWERDOWNFLAG;
      DefaultDependencies = "no";
     };
     };
    wantedBy = [ "final.target" ];
   };
   };
</syntaxhighlight>
</syntaxhighlight>
[[Category:Hardware]]