#!/bin/ksh ##################################################################### # Check the stinkin disk space. # If it's 90% or over, email somebody. # If it's 95% or over, page somebody. # # Doug Burton - 12-3-98 # # This file is used with crontab entry: # # # Check disk space every 15 min. # 0,15,30,45 * * * * /usr/local/bin/chk_dsk_space > /dev/null 2>&1 # # http://home.tampabay.rr.com/batcave/ ##################################################################### function check_bdf { bdf -l | awk '$0 !~ /^F/' > /tmp/bdf_out awk '{if (NF!=1){ if (NF==5){ print $4"\t" $5"\t" } else{ print $5"\t\t" $6"\t" } }}' < /tmp/bdf_out rm /tmp/bdf_out } check_bdf | sed 's/'%'/''/' > /tmp/bdf_info function panic { while read percent dir do if [[ $percent -ge 90 ]] ; then mailx -s "File system full-`hostname`:$dir is at $percent%" root < /dev/null if [[ $percent -ge 95 ]] ; then mailx -s "File system full-`hostname`:$dir is at $percent%" your@pager.com < /dev/null fi fi done } < /tmp/bdf_info panic rm /tmp/bdf_info