|
ElectroMech tested Document WARNQUOTA SETUP HOWTO
warnquota - send mail to users over quota
warnquota - checks the disk quota for each local filesystem and mails a warning message to those users who have reached their softlimit. It is typically run via cron(8).
Remember it working on softlimit.
The sample warnquota file is as below
[root@station253 ~]# cat /etc/warnquota.conf MAIL_CMD = "/usr/sbin/sendmail -t" FROM = "
This e-mail address is being protected from spambots. You need JavaScript enabled to view it
" SUBJECT = NOTE: Your mailbox has exceeded allocatted disk space limits CC_TO = "
This e-mail address is being protected from spambots. You need JavaScript enabled to view it
" SUPPORT = "
This e-mail address is being protected from spambots. You need JavaScript enabled to view it
" PHONE = "555 555-1212" 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. Now I have setup one partition with user quota and setup testuser1 as below
[root@station253 ~]# mount /dev/mapper/vg_station253-LogVol00 on / type ext4 (rw) proc on /proc type proc (rw) sysfs on /sys type sysfs (rw) devpts on /dev/pts type devpts (rw) /dev/sda12 on /boot type ext3 (rw) tmpfs on /dev/shm type tmpfs (rw,rootcontext="system_u:object_r:tmpfs_t:s0") none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw) sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw) gvfs-fuse-daemon on /home/nilesh/.gvfs type fuse.gvfs-fuse-daemon (rw,nosuid,nodev,user=nilesh) /dev/sda8 on /mnt/data type ext3 (rw,usrquota)
[root@station253 ~]#
[root@station253 ~]# repquota /dev/sda8 *** Report for user quotas on device /dev/sda8 Block grace time: 7days; Inode grace time: 7days Block limits File limits User used soft hard grace used soft hard grace ---------------------------------------------------------------------- root -- 416088 0 0 1608 0 0 nilesh -- 1703852 0 0 18012 0 0 testuser1 +- 5120 4096 5120 6days 200 1/3 Now [root@station253 ~]# su - testuser1
[testuser1@station253 ~]$ quota Disk quotas for user testuser1 (uid 501): Filesystem blocks quota limit grace files quota limit grace /dev/sda8 5120* 4096 5120 6days 2 0 0
[testuser1@station253 ~]$
Now when we give following command
[root@station253 ~]# warnquota -u testuser1
[root@station253 ~]# Once you execute above command try to check log with following commands.
[root@station253 ~]# tail -f /var/log/maillog --snip--
Dec 13 23:38:50 station253 postfix/local[3633]: CFD592D100: to=, orig_to=, relay=local, delay=0.09, delays=0.06/0.02/0/0.01, dsn=2.0.0, status=sent (delivered to maildir) Dec 13 23:38:50 station253 postfix/local[3633]: CFD592D100: to=, orig_to=, relay=local, delay=0.09, delays=0.06/0.03/0/0, dsn=2.0.0, status=sent (delivered to maildir) --snip-- and
[testuser1@station253 ~]$ mutt -f Maildir 17 Dec 13 support@example (0.4K) NOTE: Your mailbox has exceeded allocatted disk space limits 18 N Dec 13 support@example (0.4K) NOTE: Your mailbox has exceeded allocatted disk space limits ( Last two line is as above ) (The detail of last main is as below) (content of mail ) Date: Sun, 13 Dec 2009 23:38:50 +0530 (IST) From:
This e-mail address is being protected from spambots. You need JavaScript enabled to view it
To:
This e-mail address is being protected from spambots. You need JavaScript enabled to view it
Cc:
This e-mail address is being protected from spambots. You need JavaScript enabled to view it
Subject: NOTE: Your mailbox has exceeded allocatted disk space limits Your mailbox has exceeded the allotted limit on this server Please delete any unnecessary email in your mailbox on: /dev/sda8
Block limits File limits Filesystem used soft hard grace used soft hard grace /dev/sda8 +- 5120 4096 5120 6days 200 This message is automatically generated by the mail system. ( End of mail ) When we execute only warnquota command it will send mail to all users whose mail quota is exceeded
[root@station253 ~]# warnquota From tail -f /var/log/maillog Dec 13 23:44:03 station253 postfix/local[3699]: 7DC262D105: to=, orig_to=, relay=local, delay=0.11, delays=0.05/0.04/0/0.02, dsn=2.0.0, status=sent (delivered to maildir) Dec 13 23:44:03 station253 postfix/qmgr[1907]: 7DC262D105: removed Thats it !!!
By Nilesh J. Vaghela http://www.electromech.info
Reference http://wiki.robotz.com/index.php/Quota-_Linux_User_Quota_HowTo man warnquota
|