I'm primarily a
User Developer Sysadmin A mixture Something else entirely .. ( 396 votes ~ 7 comments )
You are not currently logged in. If you do not have a user account then please consider creating one and logging in before you post your comment. This will allow you to track replies to your comment, and take part in the site much more freely.
To add your comment, fill in all the boxes below and then preview it to make sure you're happy with the way that it looks.
This is the comment you were replying to, attached to the article Keeping track of disk space:
#10 Re: Keeping track of disk space Posted by VLegacy (69.243.xx.xx) on Tue 1 Aug 2006 at 04:39 I wrote this tiny script to check my disk space and email me if a partition filled up above 90%. I placed it under /etc/cron.hourly/. #!/usr/bin/env bash # loop over each device name culled from df with grep, excluding tmpfs entries # the device name is stored in $dev for dev in `df | grep -v tmpfs | egrep -o ^/dev/[[:alnum:]]\{3,4\}`; do used=`df | grep ^$dev | egrep -o [0-9]\{1,2\}% | egrep -o [0-9]\{1,2\}` # the percent of space used is stored in $used fs=`df | grep ^$dev | egrep -o /[[:alpha:]/]*$` # the mount point is stored in fs if [ $used -ge 90 ]; then # if more than 90% of space is used echo "$dev ($fs) is $used% full." | mail -s "$dev is low on free space." root # send a warning email to root fi done I'm sure it could be improved upon, but it's simple, and it does what I needed it to do.
Posting Format:
Inappropriate comments will be removed.
Some help on entry formatting is available
Username:
Password:
[ Advanced Login ]
Register Account