Skip to content

Instantly share code, notes, and snippets.

@ruo91
Created September 22, 2013 12:28
Show Gist options
  • Save ruo91/6659452 to your computer and use it in GitHub Desktop.
Save ruo91/6659452 to your computer and use it in GitHub Desktop.
Check disk
- 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