From 092cef3569b3426f3b5feba9762fe31a911c0049 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sat, 14 Mar 2009 13:44:47 +0100 Subject: off: exit shell if everything went ok --- etc/functions/off | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'etc/functions') 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 +} -- cgit v1.2.3