diff options
| author | Daniel Friesel <derf@derf.homelinux.org> | 2009-03-14 13:44:47 +0100 | 
|---|---|---|
| committer | Daniel Friesel <derf@derf.homelinux.org> | 2009-03-14 13:44:47 +0100 | 
| commit | 092cef3569b3426f3b5feba9762fe31a911c0049 (patch) | |
| tree | 54501358a81d90a7669f75664e347d16fb550521 /etc | |
| parent | b94180bb006da19fd1279c7e78f526e75097a1e5 (diff) | |
off: exit shell if everything went ok
Diffstat (limited to 'etc')
| -rwxr-xr-x | etc/functions/off | 8 | 
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 +} | 
