Skip to content

Instantly share code, notes, and snippets.

@johnmckerrell
Created February 15, 2014 18:00
Show Gist options
  • Save johnmckerrell/9022845 to your computer and use it in GitHub Desktop.
Save johnmckerrell/9022845 to your computer and use it in GitHub Desktop.
#!/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