summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Bratch <luke@bratch.co.uk>2015-05-15 18:15:39 +0100
committerLuke Bratch <luke@bratch.co.uk>2015-05-15 18:15:39 +0100
commit7919a246d8090f261278e3a9e02b5cf58286b901 (patch)
tree859ab5e3f276e3395c6c086937023b070b7986f2
Initial commitHEADmaster
-rwxr-xr-xfreespace20
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