Skip to content

Commit

Permalink
piapp: remove auto wake on lan servers
Browse files Browse the repository at this point in the history
  • Loading branch information
appaquet committed Jan 18, 2025
1 parent eb131eb commit 70f6323
Showing 1 changed file with 0 additions and 32 deletions.
32 changes: 0 additions & 32 deletions nixos/piapp/ups-server.nix
Original file line number Diff line number Diff line change
Expand Up @@ -54,36 +54,4 @@ in
};
};
};

# Send a WOL when we have enough runtime on UPS every 5m
systemd.timers.ups-monitor = {
wantedBy = [ "timers.target" ];
timerConfig = {
OnBootSec = "5m";
OnUnitActiveSec = "5m";
Unit = "ups-monitor.service";
};
};
systemd.services.ups-monitor = {
serviceConfig = {
Type = "oneshot";
User = "root";
};
script = ''
status=$(${pkgs.nut}/bin/upsc ups ups.status 2>&1) || true
runtime=$(${pkgs.nut}/bin/upsc ups battery.runtime 2>&1) || true
if [[ "$runtime" =~ ^[0-9]+$ ]] && [ "$runtime" -ge 1000 ]; then
slug="ups-runtime"
if [[ "$status" == "OL"* ]]; then
echo "Waking up servers"
${pkgs.wol}/bin/wol 32:2F:E6:AB:B2:E7 # servapp
${pkgs.wol}/bin/wol 8C:AE:4C:DD:5F:D0 # nasapp (2.5G)
${pkgs.wol}/bin/wol 00:11:32:b4:d0:c7 # nasapp (1G)
fi
else
echo "Not enough runtime left, skipping WOL"
fi
'';
};
}

0 comments on commit 70f6323

Please sign in to comment.