diff options
author | Daniel Friesel <derf@derf.homelinux.org> | 2009-02-08 13:45:44 +0100 |
---|---|---|
committer | Daniel Friesel <derf@derf.homelinux.org> | 2009-02-08 13:45:44 +0100 |
commit | dc6044526807ad086bf9ddcd4e651850e703044c (patch) | |
tree | ba2cb0fc55db3c31b8af74f80c1aa14737a038f9 /etc/functions/off | |
parent | 1f72c4442d54868eb7a5355eeeef8dcaf1677c4e (diff) |
off: Only check currently mounted filesystems (unmounted ones might lie on standby disks)
Diffstat (limited to 'etc/functions/off')
-rwxr-xr-x | etc/functions/off | 14 |
1 files changed, 8 insertions, 6 deletions
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 <http://sam.zoy.org/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 )) { |