Created
October 11, 2017 15:40
-
-
Save arturoherrero/72914fe9651b4a3849b2acfa0ee27f46 to your computer and use it in GitHub Desktop.
Send an email alert when the disk space gets low
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=$(df /dev/sda | grep / | awk '{ print $5}' | sed 's/%//') | |
THRESHOLD=95 | |
if [ "$CURRENT" -ge "$THRESHOLD" ]; then | |
echo "Subject: Disk space critical: $THRESHOLD% used" | /usr/sbin/sendmail -v [email protected] | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment