diff options
Diffstat (limited to 'freespace')
-rwxr-xr-x | freespace | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/freespace b/freespace new file mode 100755 index 0000000..19a3eef --- /dev/null +++ b/freespace @@ -0,0 +1,20 @@ +#!/bin/bash + +LOWBYTES="1000000000" # 1000000000 = 1 GB +HIGHPERCENT="10" + +df -B1 -x devtmpfs -x tmpfs | grep -v Filesystem | while read p +do + device=$(echo $p | awk '{print $1}') + bytes=$(echo $p | awk '{print $4}') + percent=$(echo $p | awk '{print $5}' | sed 's/%//') + if [ "$bytes" -lt "$LOWBYTES" ] + then + df -H -x devtmpfs -x tmpfs + exit + elif [ "$percent" -gt "$HIGHPERCENT" ] + then + df -H -x devtmpfs -x tmpfs + exit + fi +done |