Skip to content

Instantly share code, notes, and snippets.

@thomas4g
Created October 11, 2016 14:49
Show Gist options
  • Save thomas4g/984aa6643c4e9f6d49f13894160b9090 to your computer and use it in GitHub Desktop.
Save thomas4g/984aa6643c4e9f6d49f13894160b9090 to your computer and use it in GitHub Desktop.
Checks disk usage and rings bell forever if > 90%
#!/bin/bash
# TODO: don't hard-code the disk in the grep command
raw_usage=$(df -h | grep -e "50G" | xargs | cut -d' ' -f4)
usage=${raw_usage//%}
echo $raw_usage
if [ $usage -gt 90 ]; then
while (true); do
tput bell
sleep 1
done
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment