Created
April 5, 2022 09:32
-
-
Save brian9206/68e3bf44fd1c0a3f95016ebd63cd001d to your computer and use it in GitHub Desktop.
Disk space alert
This file contains hidden or 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 / | grep / | awk '{ print $5}' | sed 's/%//g') | |
THRESHOLD=90 | |
if [ "$CURRENT" -gt "$THRESHOLD" ] ; then | |
mail -s 'Disk Space Alert' [email protected] << 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
Place it under
/etc/cron.daily
Remember
chmod +x 10-diskspace.sh