fix: update autoshutdown script on droppie

This commit is contained in:
Benjamin Bädorf 2023-11-08 17:09:06 +01:00
parent d8f7dcc2fc
commit dfab06117a
No known key found for this signature in database
GPG key ID: 1B7BF5B77A521346
2 changed files with 18 additions and 16 deletions

View file

@ -1,11 +1,11 @@
{pkgs, ...}: let
shutdownWaitMinutes = 10;
shutdownScript = pkgs.writeShellScriptBin "shutdown-wait" ''
ssh_login_active="$(ps aux | grep "sshd: yule" | grep -v grep)"
ssh_login_active="$(${pkgs.procps}/bin/ps aux | ${pkgs.gnugrep}/bin/grep "sshd: yule" | ${pkgs.gnugrep}/bin/grep -v grep | ${pkgs.coreutils-full}/bin/wc -l)"
if [ -n "''${ssh_login_active}" ] && [ "''${ssh_login_active}" != "0" ]; then
echo "There is still an active ssh connection"
exit 1
exit 0
fi
echo "WARNING: System will be shut down within the next ${builtins.toString shutdownWaitMinutes} minutes" | ${pkgs.util-linux}/bin/wall
@ -26,7 +26,7 @@ in {
systemd.timers."shutdown-after-backup" = {
enable = true;
timerConfig = {
OnCalendar = "*-*-* 02..09:05,15,25,35,45,55:00 Etc/UTC";
OnCalendar = "*-*-* 02..11:05,15,25,35,45,55:00 Etc/UTC";
};
wantedBy = ["timers.target"];
partOf = ["shutdown-after-backup.service"];

View file

@ -17,22 +17,24 @@
boot.kernelModules = ["kvm-amd"];
boot.extraModulePackages = [];
fileSystems."/" = {
device = "/dev/disk/by-uuid/1dca9d02-555c-4b23-9450-8f3413fa7694";
fileSystems."/" =
{ device = "/dev/disk/by-uuid/1dca9d02-555c-4b23-9450-8f3413fa7694";
fsType = "xfs";
};
fileSystems."/boot" = {
device = "/dev/disk/by-uuid/A24C-F252";
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/A24C-F252";
fsType = "vfat";
};
fileSystems."/media/internal" = {
device = "/dev/disk/by-uuid/5cf314a8-82f4-4037-a724-62d2ff226cff";
fileSystems."/media/internal" =
{ device = "/dev/disk/by-uuid/5cf314a8-82f4-4037-a724-62d2ff226cff";
fsType = "ext4";
};
swapDevices = [{device = "/dev/disk/by-uuid/0203b641-280f-4a3d-971d-fd32a666c852";}];
swapDevices =
[ { device = "/dev/disk/by-uuid/0203b641-280f-4a3d-971d-fd32a666c852"; }
];
powerManagement.cpuFreqGovernor = lib.mkDefault "ondemand";
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;