Created
September 22, 2013 12:28
-
-
Save ruo91/6659452 to your computer and use it in GitHub Desktop.
Check disk
This file contains 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
- code | |
#!/bin/bash | |
df -h | awk '/%/ { | |
limit = 70 | |
percent = sprintf("%d",$5) | |
if ( percent > limit ) { | |
print "Warning: ",$6," (",$1,") is to ",percent,"% full:" | |
print $0 | |
} | |
}' | |
- result | |
[root@dev ~]# ./check.sh | |
Warning: /storage ( /dev/vdb1 ) is to 75 % full: | |
/dev/vdb1 985G 696G 240G 75% /storage |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment