Created
April 7, 2018 18:37
-
-
Save TravisMullen/876e0c0f9f53f4ab8904b3f77a93a210 to your computer and use it in GitHub Desktop.
This script does a very simple test for checking disk space.
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 | |
# This script does a very simple test for checking disk space. | |
space=`df -h | awk '{print $5}' | grep % | grep -v Use | sort -n | tail -1 | cut -d "%" -f1 -` | |
case $space in | |
[1-6]*) | |
Message="All is quiet." | |
;; | |
[7-8]*) | |
Message="Start thinking about cleaning out some stuff. There's a partition that is $space % full." | |
;; | |
9[1-8]) | |
Message="Better hurry with that new disk... One partition is $space % full." | |
;; | |
99) | |
Message="I'm drowning here! There's a partition at $space %!" | |
;; | |
*) | |
Message="I seem to be running with an nonexistent amount of disk space..." | |
;; | |
esac | |
echo $Message |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment