Skip to content

Instantly share code, notes, and snippets.

@albarki albarki/ forked from fduran/gist:1870429
Last active Jun 25, 2018

What would you like to do?
Linux disk space email alert
# script that will send an email to EMAIL when disk use in partition PART is bigger than %MAX
# adapt these 3 parameters to your case
USE=`df -h |grep $PART | awk '{ print $5 }' | cut -d'%' -f1`
if [ $USE -gt $MAX ]; then
echo "Percent used: $USE" | mail -s "Running out of disk space" $EMAIL

This comment has been minimized.

Copy link
Owner Author

albarki commented Jun 25, 2018

to install mail if it is not exist check here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.