Uninterruptible power supply: Difference between revisions

Tie-ling (talk | contribs)
environment var
Wo2wz (talk | contribs)
remove unnecessary portion under compatible hardware
 
(5 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 = {
    enable = true;
       NUT_CONFPATH = "/etc/nut";
     environment = config.systemd.services.upsmon.environment;
    description = "Initiate delayed UPS shutdown";
    before = [ "umount.target" ];
    wantedBy = [ "final.target" ];
    serviceConfig = {
       Type = "oneshot";
      # need to use '-u root', or else permission denied
      ExecStart = ''${pkgs.nut}/bin/upsdrvctl -u root shutdown'';
      # must not use slice: if used, upsdrvctl will not run as a late
      # shutdown service
      # Slice = "";
     };
     };
     unitConfig = {
     unitConfig = {
       Description = "Initiate delayed UPS shutdown";
       ConditionPathExists = config.power.ups.upsmon.settings.POWERDOWNFLAG;
      Before = "umount.target";
       DefaultDependencies = "no";
       DefaultDependencies = false;
    };
    serviceConfig = {
      Type = "oneshot";
      ExecStart = ''${pkgs.bash}/bin/bash -c\
      "${pkgs.util-linux}/bin/logger -t\
        nut-delayed-ups-shutdown 'upsdrvctl shutting down UPS';\
        ${pkgs.nut}/bin/upsdrvctl shutdown"'';
     };
     };
    wantedBy = [ "final.target" ];
   };
   };
</syntaxhighlight>
</syntaxhighlight>
[[Category:Hardware]]