Last active
August 30, 2021 15:55
-
-
Save developerck/0dac67ecaf9abd4e8844c105f15ab56f to your computer and use it in GitHub Desktop.
show the disk usage
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
#!/bin/sh | |
df -Ph | grep -vE '^Filesystem|tmpfs|cdrom' | awk '{ print $5,$1 }' | while read output; | |
do | |
max=40% | |
echo $output | |
used=$(echo $output | awk '{print $1}') | |
partition=$(echo $output | awk '{print $2}') | |
if [ ${used%?} -ge ${max%?} ]; then | |
echo "The partition \"$partition\" on $(hostname) has used $used at $(date)" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment