From d6d02066cb61052f9776e53eeed3fc00ea11d05b Mon Sep 17 00:00:00 2001 From: age Date: Fri, 7 Apr 2006 14:41:51 +0000 Subject: [PATCH] plattenplatzwarnung --- spielspass/capacity_check.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100755 spielspass/capacity_check.sh diff --git a/spielspass/capacity_check.sh b/spielspass/capacity_check.sh new file mode 100755 index 0000000..021cf7f --- /dev/null +++ b/spielspass/capacity_check.sh @@ -0,0 +1,15 @@ +#!/bin/sh +## give max disk usage in %, after that a warning will be produced + MAX=85 + ## looks for mounted filesystems, but not proc,sys,... + DISKS=`mount |grep -iv proc |grep -iv sysfs |awk '{print $3}'` + + for DISK in $DISKS; do + USAGE=`df -k $DISK | tail -n 1 | awk '{print $5}' | cut -d"%" -f1` + # if no number is given as percentage, do nothing + echo "$USAGE" |grep -q [0-9] && if [ $USAGE -gt $MAX ]; then + echo "$DISK is at ${USAGE}% capacity" + #mail root@sao -s "$DISK explodiert gleich" + fi + done +