Skip to content

Instantly share code, notes, and snippets.

@vielhuber
Created October 13, 2023 11:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vielhuber/f36846021ef89d8ddff6718237d726d4 to your computer and use it in GitHub Desktop.
Save vielhuber/f36846021ef89d8ddff6718237d726d4 to your computer and use it in GitHub Desktop.
send mail alert on quota #linux #server
#!/bin/bash
CURRENT=$(df / | grep / | awk '{ print $5}' | sed 's/%//g')
THRESHOLD=80
if [ "$CURRENT" -gt "$THRESHOLD" ] ; then
mail -s 'Project XY: Disk Space Alert' email1@tld.com, email2@tld.com, email3@tld.com << EOF
Your root partition remaining free space is critically low. Used: $CURRENT%
EOF
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment