summary refs log tree commit diff
diff options
context:
space:
mode:
authorRory& <root@rory.gay>2026-01-30 20:44:06 +0100
committerRory& <root@rory.gay>2026-01-30 20:44:06 +0100
commit207965de3393ec844a0318262f844fdef0533fef (patch)
tree3d3166e468b1e0825ad919c70a701b81a324b531
parentServer updates (diff)
downloadRory-Open-Architecture-207965de3393ec844a0318262f844fdef0533fef.tar.xz
Try running shell kill script as root
-rwxr-xr-xhost/Rory-ovh/configuration.nix19
1 files changed, 12 insertions, 7 deletions
diff --git a/host/Rory-ovh/configuration.nix b/host/Rory-ovh/configuration.nix

index ac9add5..f90e99d 100755 --- a/host/Rory-ovh/configuration.nix +++ b/host/Rory-ovh/configuration.nix
@@ -130,16 +130,21 @@ }; # prevent a hang on rebuild with forgotten shells... - systemd.services."container@spacebar" = { + systemd.services."container@spacebar" = + let + mkKillShellScript = ctName: ("+-" + (pkgs.writeScript "kill-shell-" + ctName + "" '' + #!/bin/sh + for pid in $(pgrep -f "nixos-container root-login ${ctName}"); do + echo "Killing shell with PID $pid" + kill -9 "$pid" + done + '')); + in + { # dependency on postgres for good measure... after = [ "postgresql.service" ]; wants = [ "postgresql.service" ]; - preStop = '' - for pid in $(pgrep -f "nixos-container root-login spacebar"); do - echo "Killing shell with PID $pid" - kill -9 "$pid" - done - ''; + serviceConfig.ExecStop = mkKillShellScript "spacebar"; }; #containers."syntest1" = import ./services/containers/syntest1/container.nix {