From 7919a246d8090f261278e3a9e02b5cf58286b901 Mon Sep 17 00:00:00 2001 From: Luke Bratch Date: Fri, 15 May 2015 18:15:39 +0100 Subject: Initial commit --- freespace | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100755 freespace 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 -- cgit v1.2.3