summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@derf.homelinux.org>2009-03-14 13:44:47 +0100
committerDaniel Friesel <derf@derf.homelinux.org>2009-03-14 13:44:47 +0100
commit092cef3569b3426f3b5feba9762fe31a911c0049 (patch)
tree54501358a81d90a7669f75664e347d16fb550521
parentb94180bb006da19fd1279c7e78f526e75097a1e5 (diff)
off: exit shell if everything went ok
-rwxr-xr-xetc/functions/off8
1 files changed, 6 insertions, 2 deletions
diff --git a/etc/functions/off b/etc/functions/off
index 189e8ec..05c67fa 100755
--- a/etc/functions/off
+++ b/etc/functions/off
@@ -7,14 +7,14 @@ autoload warn fdie
typeset filesystem garbage file
typeset -a filesystems
typeset tune2fs
-typeset -i force reboot simulate
+typeset -i force reboot simulate exit_ok=1
typeset gone
function execute {
if (( simulate )) {
echo $*
} else {
- $*
+ $* || exit_ok=0
}
}
@@ -75,6 +75,7 @@ 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 )) {
+ exit_ok=0
echo "notice: filesystem $filesystem due to check in $((tune2fs[2] - tune2fs[1])) mounts"
}
}
@@ -83,3 +84,6 @@ if (( reboot )) {
} else {
execute sudo halt
}
+if (( exit_ok )) {
+ execute exit
+}