Created
February 15, 2014 18:00
-
-
Save johnmckerrell/9022845 to your computer and use it in GitHub Desktop.
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 | |
# check-disk-usage.sh | |
# John McKerrell 2014 | |
# | |
# Basic script that pops up a notification if disk usage | |
# on a given device is over a given figure. Could be run | |
# in a cronjob for instance as: | |
# check-disk-usage.sh sda1 95 | |
DISK="$1" | |
MAX_USAGE="$2" | |
usage=$(df | grep $DISK | awk '{ print $5 }' | sed 's/[^0-9]//g' ) | |
if [ "$usage" -gt "$MAX_USAGE" ]; then | |
xbmc-send --action="Notification(Disk Usage,Usage is $usage)" > /dev/null | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment