ref: dc6f3c38d572d0afb83160d272a6c27f30e76c04
parent: 4f2a18dcee8c5e511bf5c535aa6d4918f1221322
author: joe9 <joe9mail@gmail.com>
date: Thu Jul 29 00:52:58 EDT 2021
kfs sync before shutdown
--- a/dis/shutdown
+++ b/dis/shutdown
@@ -3,12 +3,13 @@
x=$*
{~ $#x 1 && ~ ${hd $x} -h -r} || {echo usage: shutdown -h or shutdown -r >[1=2]; exit usage}
# the following is a bit pointless until kfs has halt
-#ftest -f /dis/disk/kfscmd.dis && {
-# for(a in /chan/kfs.*.cmd){
-# b=${hd ${tl ${split '.' $a}}}
-# ~ $b '*' || disk/kfscmd -n $b halt
-# }
-#}
+# but, the sync will atleast write out all the dirty blocks
+ftest -f /dis/disk/kfscmd.dis && {
+ for(a in /chan/kfs.*.cmd){
+ b=${hd ${tl ${split '.' $a}}}
+ ~ $b '*' || disk/kfscmd -n $b sync # halt
+ }
+}
if {~ $1 -r} {
echo reboot >/dev/sysctl
} {~ $1 -h} {