#!/bin/sh # # diskmon: disk monitor (check if partitions are getting full) # # usage: install, chmod, and crontab a la: # # 20 */2 * * * /usr/local/sbin/diskmon # # Gerald Oskoboiny, 4 May 2000 # # source: http://impressive.net/people/gerald/2000/05/04/diskmon # # $Id: diskmon,v 1.4 2003/03/15 03:42:24 gerald Exp $ # diskmondir=/tmp/_diskmon; export diskmondir if [ ! -d $diskmondir ]; then mkdir $diskmondir fi df -l -k | egrep '(9|10).%' | awk '{print $5, $6}' | while read level part ; do flag=`echo $part $level | sed 's/[^A-Za-z0-9]/-/g'` if [ ! -f $diskmondir/$flag ]; then # haven't complained about this level on this partition yet echo Partition $part has reached $level touch $diskmondir/$flag; # remember that we complained about it fi done # # changelog: # # $Log: diskmon,v $ # Revision 1.4 2003/03/15 03:42:24 gerald # replaced \W with [^A-Z etc] to avoid probs with sed v4 on devo (deb sarge) # # Revision 1.3 2002/09/04 22:03:02 gerald # added brief usage docs # # Revision 1.2 2002/09/04 21:58:49 gerald # added changelog, link to source code # #