SMS Notifications

Hal Burgiss hal at burgiss.net
Wed Oct 10 23:49:54 UTC 2007


On Wed, Oct 10, 2007 at 01:39:10PM -0500, Ryan Nichols wrote:
> Does anyone have some suggestions on an application that will monitor my 
> disk space on my box and if it falls below a certain value to send a msg 
> to a cellular phone or email?

If only worried if its near capacity, something like:

#!/bin/bash

threshold=90

for i in $(df |grep -v Filesystem |sed 's/.* \([0-9][0-9]\?\)%.*/\1/g'); do 
     [ $i -gt $threshold ] && callnow=true
done

[ $callnow ] && df | mail -s DiskAlert 5555555555 at somecell.net

#

would work. Probably a good thing to do though is create a lockfile so
it doesn't keep sending messages every few minutes, or however you run
it from cron:

lockfile=/tmp/$(basename $0).lock
[ -f $lockfile ] && exit 

Just remember to remove the lockfile.

You can do similar things with temperatures and other system
components. 

-- 
Hal
 




More information about the ubuntu-users mailing list