Sophie

Sophie

distrib > Fedora > 16 > i386 > by-pkgid > 24ec9e49274d437931ccf118605118cb > files > 8

mldonkey-3.0.3-1.fc15.src.rpm

#!/bin/sh

CACHEDIR="/var/cache/mldonkey"
MINFREE=102400
EMAIL="root@localhost"

. /etc/sysconfig/mldonkey

[ ! "$ENABLE_DF_MONITOR" = "yes" ] && exit

send_email() {
	mail -s "mldonkey, disk space warning" $EMAIL << EOF

your $CACHEDIR has only $CURFREE KiB free space left
all downloads paused

BTW: you can control this check by editing /etc/sysconfig/mldonkey.
EOF
}


CURFREE=`df -P -k $CACHEDIR | tail -n 1 | awk '{ print $4 }'`
if [ $CURFREE -lt $MINFREE ] ; then
	/etc/init.d/mldonkey pause > /dev/null
	send_email
fi