From dc6044526807ad086bf9ddcd4e651850e703044c Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sun, 8 Feb 2009 13:45:44 +0100 Subject: off: Only check currently mounted filesystems (unmounted ones might lie on standby disks) --- etc/functions/off | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'etc') diff --git a/etc/functions/off b/etc/functions/off index 9af768a..05b786d 100755 --- a/etc/functions/off +++ b/etc/functions/off @@ -4,7 +4,7 @@ ## License: WTFPL autoload warn fdie -typeset filesystem line IFS=$'\n' +typeset filesystem garbage typeset -a filesystems typeset tune2fs typeset -i force reboot simulate @@ -49,11 +49,13 @@ if pgrep -x amarokapp &> /dev/null; then fi execute uinit -o text stop-all -for line in $(cat /etc/fstab); { - if [[ $line == *[12] ]] { - filesystems+=${${(s: :)line}[1]} - } -} + +while read filesystem garbage; do + if [[ $garbage == *[12] ]] && fgrep $filesystem /etc/mtab &> /dev/null; then + filesystems+=$filesystem + fi +done < /etc/fstab + for filesystem in $filesystems; { tune2fs=($(sudo tune2fs -l $filesystem | fgrep -i 'mount count' | grep -o '[0-9]*')) if (( tune2fs[2] - tune2fs[1] < 5 )) { -- cgit v1.2.3