From 955b6e91b46b1be37677b3aba824b3e62913658b Mon Sep 17 00:00:00 2001 From: Dan Date: Mon, 5 Jan 2026 09:12:46 -0800 Subject: [PATCH] Fix killswitch paths in watchdog scripts, remove replaceStrings workaround --- configuration.nix | 10 ++-------- scripts/cpu-watchdog | 2 +- scripts/egress-watchdog | 2 +- 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/configuration.nix b/configuration.nix index e7a1a4f..8354b0d 100644 --- a/configuration.nix +++ b/configuration.nix @@ -14,10 +14,7 @@ let cpu-watchdog = pkgs.writeShellApplication { name = "cpu-watchdog"; runtimeInputs = with pkgs; [ procps gawk coreutils util-linux killswitch ]; - text = builtins.replaceStrings - [ "/usr/local/bin/killswitch" ] - [ "killswitch" ] - (builtins.readFile ./scripts/cpu-watchdog); + text = builtins.readFile ./scripts/cpu-watchdog; }; egress-watchdog = pkgs.writeShellApplication { @@ -25,10 +22,7 @@ let # Note: -e removed intentionally - grep returns 1 when no matches bashOptions = [ "nounset" "pipefail" ]; runtimeInputs = with pkgs; [ systemd gnugrep coreutils util-linux killswitch gawk ]; - text = builtins.replaceStrings - [ "/usr/local/bin/killswitch" ] - [ "killswitch" ] - (builtins.readFile ./scripts/egress-watchdog); + text = builtins.readFile ./scripts/egress-watchdog; }; # ========================================================================== diff --git a/scripts/cpu-watchdog b/scripts/cpu-watchdog index 777c576..086c82e 100755 --- a/scripts/cpu-watchdog +++ b/scripts/cpu-watchdog @@ -33,7 +33,7 @@ for homedir in /home/*; do logger -t cpu-watchdog "User $user at ${pct}% CPU (strike $count/$MAX_STRIKES)" if [ "$count" -ge "$MAX_STRIKES" ]; then - /usr/local/bin/killswitch "$user" "sustained CPU abuse (${pct}%)" + killswitch "$user" "sustained CPU abuse (${pct}%)" rm -f "$COUNTDIR/$user" fi else diff --git a/scripts/egress-watchdog b/scripts/egress-watchdog index bc2a26b..3313047 100755 --- a/scripts/egress-watchdog +++ b/scripts/egress-watchdog @@ -41,7 +41,7 @@ while read -r count uid; do logger -t egress-watchdog "User $user hit egress limit $count times (strike $strikes/$MAX_STRIKES)" if [ "$strikes" -ge "$MAX_STRIKES" ]; then - /usr/local/bin/killswitch "$user" "egress abuse ($count blocked connections)" + killswitch "$user" "egress abuse ($count blocked connections)" rm -f "$COUNTDIR/$user" fi else