Created
September 1, 2022 20:32
-
-
Save nikeshashar/ddab2d693aa09755658bc264f1e12d7c to your computer and use it in GitHub Desktop.
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/zsh | |
# Disk percentage usage to alert on, 90 is 90% used | |
targetFreeSpace=90 | |
diskPercentageUsed=$( /bin/df -H | /usr/bin/awk '/\/dev\/disk1s1/ {print $5}' | /usr/bin/tr -d '%') | |
echo "Disk percent used: $diskPercentageUsed" | |
if [ "$diskPercentageUsed" -gt "$targetFreeSpace" ]; then | |
exit 1 | |
else | |
exit 0 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment