Created
March 21, 2016 13:45
-
-
Save urbels/a1ef6b1e8342510ea365 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
CURRENT=$(/usr/bin/quota | awk '{print $2,$3}' | awk 'NR==3{print}' | awk '{print $1}') | |
MAX=$(/usr/bin/quota | awk '{print $2,$3}' | awk 'NR==3{print}' | awk '{print $2}') | |
x=$CURRENT | |
y=$MAX | |
z=$((x*100/y)) | |
THRESHOLD=60 | |
if [ "$z" -gt "$THRESHOLD" ] ; then | |
/usr/sbin/sendmail example@example.com << EOF | |
Subject: Disk space alert | |
Disk quota reached $THRESHOLD%. Current quota: $CURRENT | |
EOF | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment