Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Hi everyone, I'm having a bit of a tough time with this one, and I was hoping I could get some advice...
A couple of months back, my company moved from a Windows to a Linux mail server. Translation: I needed to learn Linux. I've done pretty well with it, and have been please overall with the performance enhancements from Linux, but I'm 100% self-taught, and still relatively new to the OS, so be gentle :-)
We are running Red Hat 8, with Sendmail as our MTA. We have aprox 260 users over 80+ domains on this one server. Users can access their mail boxes via POP3, or the web (SquirrelMail (IMAP)). None of the users with email addresses on the server have been granted login privileges to a shell (shell = /sbin/nologin).
Yesterday evening, I got a cal from a user complaining that they couldn't get any new mail. I looked into it and, long story short, the /var/spool/mail directory was using up all the space allocated to that partition. I went through and cleaned out as many useless files as I could, which solved the immediate problem. However, I have now been charged with the task of making sure this doesn't happen again by establishing mailbox quotas.
To give every user on the machine a 5 MB mailbox limit. When they real 4.5 MB, they get an email telling them that they are approaching their size limit, and must delete some messages. When they reach they size limit, anyone sending them email should receive a message back indicating that the user they are trying to email has reached the size limit for their mailbox, and they should try again later. I pretty much want to mimic the functionality of MS Exchange (or any of the big webmail providers, i.e. - Hotmail, yahoo, etc.).
What I've done:
I have enabled quotas on my /var mount, and set up a aquota.user file. I established the quotas for one test account, but the problem is, when someone emails a message to a user who is over quota, neither the sender or the user are notified. I considered writing a script which checks the size of each user's mailbox and emails warnings to anyone over 4.5 MB, but the only way I know how to check disk usage from a shell script is with the du command, and since it can only look at directories (and the user mailboxes are all contained as separate files in one directory) I can't figure out how I could isolate each individual mailbox to check its size. And even if I could get this to work, it would only serve to notify the user that they where near the limit. It wouldn't solve the problem of notifying senders that their messages hadn't been delivered. My boss swears to me that there has to be a better way to do this, as other email providers do it all the time; but I can't find any better way.
Questions: PLEASE help with these!!!
1. Is there any pre-packaged software program out there to do this sort of thing?
2. If not, is there a better way to do this than with disk quotas?
3. How can I check and notify users when they are near their max size limit?
4. How can I notify senders that the mailbox they are attempting to send a message to is full?
Any help anyone can provide (or even just point me in the right direction) would be VERY much appreciated.
Originally posted by ganninu Has anybody an answer to locoiguana's questions? I have the same problem
Wish I had better news for you, ganninu, but I haven't found a really good solution yet. I'm really not too into switching my whole system over to qmail, so I've taken to just regularly clearing out mailboxes that are too big, and sending reminders to users that I know to be major offenders to clean out their mailboxes from time to time.
Also a newbie here so I don't have a definitive, working answer to your problem. I have an idea of how I might approach it. I would use a combination of Perl, cron, and mail.
The cron program would periodically (daily?) run a Perl program which would run your du and output that to a file. Perl would then grep that file for your quota parameters. Using the results of that, Perl would then mail the user and admin (you).
I have to admit that my authoring skills are not up to the task, but I'm working on it.