aboutsummaryrefslogtreecommitdiffstats
path: root/rc.d
diff options
context:
space:
mode:
Diffstat (limited to 'rc.d')
-rwxr-xr-xrc.d/init.d/halt5
1 files changed, 5 insertions, 0 deletions
diff --git a/rc.d/init.d/halt b/rc.d/init.d/halt
index 0afe13b4..44d4eaaf 100755
--- a/rc.d/init.d/halt
+++ b/rc.d/init.d/halt
@@ -119,6 +119,11 @@ esac
runcmd $"Syncing hardware clock to system time" /sbin/hwclock $CLOCKFLAGS
+# Try to unmount tmpfs filesystems to avoid swapping them in. Ignore failures.
+tmpfs=$(awk '$2 ~ /^\/($|proc|dev)/ { next; }
+ $3 == "tmpfs" { print $2; }' /proc/mounts | sort -r)
+[ -n "$tmpfs" ] && umount $tmpfs 2>/dev/null
+
# Turn off swap, then unmount file systems.
[ -f /proc/swaps ] && SWAPS=`awk '! /^Filename/ { print $1 }' /proc/swaps`
[ -n "$SWAPS" ] && runcmd $"Turning off swap: " swapoff $SWAPS