Koozali.org: home of the SME Server
Obsolete Releases => SME 7.x Contribs => Topic started by: robwellesley on September 02, 2009, 03:20:18 AM
-
Script assumes default SME7 fstab.
Highlite and copy this
################
#!/bin/sh
DOMAIN=`/sbin/e-smith/db configuration get DomainName`
SYSTEM=`/sbin/e-smith/db configuration get SystemName`
df -P | grep -vE '^Filesystem|tmpfs|cdrom' | awk '{ print $5 " " $1 }' | while read output;
do
# echo $output
usep=$(echo $output | awk '{ print $1}' | cut -d'%' -f1 )
partition=$(echo $output | awk '{ print $2 }' )
if [ $usep -ge 90 ]; then
echo "Running out of space \"$partition ($usep%)\" on $(hostname).$DOMAIN as on $(date)" | \
mail -s "ALERT: $usep% Disk Use on $SYSTEM.$DOMAIN" admin
fi
done
##############
Using Putty or similar...
cd /etc/cron.daily
pico diskusage.sh
Right click will paste into putty
edit .... $usep -ge 90... (default 90 will alert you at 90% usage, you can test it by making the 90 to be less than current disk use)
edit email recipient if you like (default is admin - can be anyone@anydomain)
CTRL X
Enter
Chmod 755 diskusage.sh
-
thank you but.. why don't you use logwatch? :-)
it will send a mail every day with disk usage and much more
Stefano
-
...cos I don't want a mail everyday ?
-
well, it could be a good reason, but I don't subscribe it ;-)