diff options
author | Joe Rayhawk <jrayhawk@fairlystable.org> | 2023-07-12 20:20:40 -0700 |
---|---|---|
committer | Joe Rayhawk <jrayhawk@fairlystable.org> | 2023-07-12 20:20:40 -0700 |
commit | 1286766428e5b32fed04fcaf6169a2831c0ec996 (patch) | |
tree | d2637634540ce9f4ae1f1b03c5f6fff6d0a31d6c | |
parent | cae944f99eb26abc0edb51db6f676c897d73d99b (diff) | |
download | fswarn-master.tar.gz fswarn-master.zip |
-rwxr-xr-x | sbin/fswarn | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/sbin/fswarn b/sbin/fswarn index 82fe6df..278fcb7 100755 --- a/sbin/fswarn +++ b/sbin/fswarn @@ -18,6 +18,7 @@ STATETEMP=$(mktemp fswarn.XXXXXXXX) for i in $( grep -E ' ('$( for FSTYPE in $( grep -v ^nodev /proc/filesystems ); do echo -n "$FSTYPE|"; done; echo -n "ramfs|tmpfs" )') ' /proc/mounts | cut -f 2 -d ' ' | sort -u ); do BLOCKFREE=$( stat -f -c %a $i ) BLOCKTOTAL=$( stat -f -c %b $i ) + [ $BLOCKTOTAL -eq 0 ] && continue # ramfs-as-file does this; skip it BLOCKALLOC=$(( ${BLOCKTOTAL} - ${BLOCKFREE} )) BLOCKPERCENT=$(( 100 * ${BLOCKALLOC} / ${BLOCKTOTAL} )) BLOCKOLDPERCENT=$( grep "^${i} " ${STATEFILE} | cut -f 4 -d ' ' | grep . ) 2>/dev/null || BLOCKOLDPERCENT=0 |