1
0
Fork 0

configure shutdown instructions in runit stage 3

This commit is contained in:
Florian Agbuya 2024-02-22 09:58:13 +08:00
parent 1f3591a693
commit e4dcc0e84a
2 changed files with 29 additions and 0 deletions

View File

@ -19,6 +19,7 @@
./pr-28.patch
./pr-29.patch
./pr-30.patch
./pr-31.patch
];
};

28
pr-31.patch Normal file
View File

@ -0,0 +1,28 @@
diff --git a/runit.nix b/runit.nix
index d7b0bf3..64f99f2 100644
--- a/runit.nix
+++ b/runit.nix
@@ -57,6 +57,23 @@ in
'';
"runit/3".source = pkgs.writeScript "3" ''
#!${pkgs.runtimeShell}
+ echo Waiting for services to stop...
+ sv force-stop /etc/service/*
+ sv exit /etc/service/*
+
+ echo Sending TERM signal to processes...
+ pkill --inverse -s0,1 -TERM
+ sleep 1
+ echo Sending KILL signal to processes...
+ pkill --inverse -s0,1 -KILL
+
+ echo Unmounting filesystems, disabling swap...
+ swapoff -a
+ umount -r -a -t nosysfs,noproc,nodevtmpfs,notmpfs
+ echo Remounting rootfs read-only...
+ mount -o remount,ro /
+
+ sync
echo and down we go
'';
"service/sshd/run".source = pkgs.writeScript "sshd_run" ''