first of all thank you very much....
I tried to follow your instructions right but I have this an error from the script: sed: -e expression #1, char 17: Unknow option to 's' No recipient addresses found in header I'd think that the error was in the quote of the sed command but when I changed to single quote the message is send to $[EMAIL PROTECTED] I added mydomain after the (address) in the /etc/toomuchmail.txt couse I think that is the way, am I right? well, probably it is a little detail however thanks a lot... ----- Original Message ----- From: "David Guntner" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Saturday, October 27, 2001 3:18 AM Subject: Re: [expert] quotas again... please read me! > Julio Rodriguez grabbed a keyboard and wrote: > > > > this is the task: > > When the mailbox of a user on /var/mail/user have certain size > > (i.e. user > 1000) the server generate a automatic warning mail for the > > user about the size exceding on his account (soft limit), so the user knows > > what is going on with his account... > > > > Could you please get me a little help with this??? > > This is something I threw together quickly. There may be a way of > streamlining what is done here, but this does work. :-) > > First, login as root and create a file in /etc called toomuchmail.txt. This > will contain the text of the warning message that you want to send. > > > [root@rhpsfan2 mail]# cat /etc/toomuchmail.txt > To: (address) > Subject: Mail file is too big > > This is a quick note to let you know that your mail file is too large. > Please download messages that you want to keep to your own computer, and > delete them from your mail file here on the system. Thank you. > > System Administrator > [root@rhpsfan2 mail]# > > (The root@rhpsfan stuff is part of my system prompt. :) > > Season the text of the warning message to suit your tastes. But leave that > To: line as it reads above! :-) Make it mode 644 or 600, depending on > whether or not you want your regular users to be able to read the contents > without it being mailed to them. <grin> > > Next, create /sbin/mailsizecheck. This one should probably be mode 700. You > can set it 744 if you want your users to see what the script is doing. No > need to set the execute bit for regular users, since you don't want them > running the thing anyway. :-) > > > [root@rhpsfan2 mail]# cat /sbin/mailsizecheck > #/bin/bash > > # Check mail file sizes for all users. > > umask 077 > > rm -f /tmp/address.list # make sure it's not already there > > cd /var/spool/mail > > # Find the big ones and build our list of addresses.... > find . -type f -size +1000k -print | sed 's/\.\///' >/tmp/address.list > > # Take the list and send the warning message to each one > for address in `cat /tmp/address.list` ; do > cat /etc/toomuchmail.txt | sed "s/(address)/$address/" | \ > /usr/sbin/sendmail -t ; > done > > rm -f /tmp/address.list # clean up after ourselves :-) > > # End of script > [root@rhpsfan2 mail]# > > > Then, all you have to do is setup a crontab entry which runs > /sbin/mailsizecheck once a day, and you're all set. > > HTH. > > --Dave > > --------------------------------------------------------------------------- - ---- > Want to buy your Pack or Services from MandrakeSoft? > Go to http://www.mandrakestore.com >
Want to buy your Pack or Services from MandrakeSoft? Go to http://www.mandrakestore.com