LINUX


Monday 3 June 2013

Configure Linux Warnquota for Fedora / Ubuntu / RHEL / CentOS

In Linux, Most of the People Implement User Quota and Group Quota on Linux and The Might want to send e-mail warnings to the User by e-mail.
It Becomes very Important when the Mail Server is Running and You have implemented Disk Quota / User Quota / Group Quota for Users, So Its the First Basic requirement that We have to inform Users on Their Quota Usage at the Limit which we have configured.
So I am writing this article for Those Who have implemented a Quota and Do not know How to configure quota warning by e-mail.
quota


1. quota / quota-warnquota package must be Installed.
To Confirm :-
On RHEL / CentOS :- [root@tejas-barot-linux-support ~]# rpm -qa | grep quota # Output should not be empty
On Ubuntu :- root@tejas-barot-linux-support:~# dpkg –list | grep quota # Output should not be empty
2. Partition / Device must be mounted with usrquota
On RHEL / CentOS / Ubuntu :- [root@tejas-barot-linux-support ~]#mount | grep quota # Output should not be empty
3. Quota Must be Enabled on Partition.
4. If Above command is giving you proper output then you are good to go for Further Configuration.

5. Now Open /etc/warnquota.conf and Modify Following values as per your requirement.
Enjoy Disk Quotas :) Enjoy WarnQuota :) Enjoy Linux :) Enjoy Open Source :)
   MAIL_CMD        = "/usr/sbin/sendmail -t"
   FROM            = "linuxsupport@tejasbarot.com"
   SUBJECT         = NOTE: Your mailbox has exceeded allocatted disk space limits
   CC_TO           = "ahmedabad@tejasbarot.com"
   SUPPORT         = "linuxblog@tejasbarot.com"
   PHONE           = "000 111-2222"
   MESSAGE         = Your mailbox has exceeded the allotted limit\
    on this server|Please delete any unnecessary email in your mailbox on:|
   SIGNATURE       = This message is automatically generated by the mail system.
Once you are done with Configuring this Parameters Save and Exit from File
Description of above Configurations :-
MAIL_CMD = Command which used to send an e-mail.
FROM = Which E-Mail ID it will display to Recipient.
SUBJECT = Subject line which you want to Mention for Warning e-mail.
CC_TO = On Which ID it will Send Carbon Copy of the Mail.
SUPPORT =  Email ID which you have to mentioned as Support or anybody else where it should inform too.
PHONE = Of-course It will be a Number which you want to display as your Contact Number.
MESSAGE = Detailed Message OR Instructions Which you want to Send to the User. In Short, Body of the Mail.
SIGNATURE = Text which you have to set as your Signature.
6. Once It is configured properly, then To Send E-mail to all those users who exceeded quota then Execute Following command :-
Execute Command To Send E-Mail to All Those Users / Groups who exceeded quota or Grace Limit :-
[root@tejas-barot-linux-support ~]# warnquota
Execute Command To Send E-Mail to Particular User who exceeded quota or Grace Limit :-
[root@tejas-barot-linux-support ~]# warnquota -u <user-name>

Execute Command To Send E-Mail to Particular Group who exceeded quota or Grace Limit :-
[root@tejas-barot-linux-support ~]# warnquota -g <user-name>
7. That’s IT. Warning for Quota is configured.

No comments:

Post a Comment