Script for Exceeding Quota
Hi All Linux Experts
I have configured quota on our linux server. But now I want to make a script which should keep watching the quota status all the time & when any user exceeds quota it should mail me & the user regarding the quota limit exceeded. I dont want the cron job to do that. Any help will be highly appreciated. Thanks in Advance Sushant Chawla Linux Administrator |
Hi Suhsant,
Well you can have a background while loop running infinitely for this job, if you do not want to use cron. For eg. Code:
((while true;do date; sleep 1800; done;) >> /any/file ) & I recommend using "quota -q" command and do some filtering work on it. Get back if you need some other suggestion/help. |
Hi Vikas firstly I would like to thank you for giving me ur precious time.
Now the situation is I am using this quota command but it is not showing any output then how can I filter its contents. But still it is sending mails to the users who have exceeded quota limit. |
Quote:
1)try Code:
repquota -a 2)Are you sure you are root ? 3)What is the output after running the command ? 4)Paste the output of Code:
quotacheck -av Always, give details of the OS (cat /etc/redhat-release) and paste output of commands in your threads. . |
Vikas
repquota -a command is working & I am using it from starting for report generation of users using quota. But I want a script that will invoke as soon as any user crosses the quota limit. The script in the background will take the unnecessary resources of server. I want the script will be invoked only when any user crosses the quota limit |
Quote:
I dont have quota on any of my systems, I need a sample file. Also, you did not answered my Quest 2, 3 and 4. |
Vikas
repquota -a command is working & I am using it from starting for report generation of users using quota. But I want a script that will invoke as soon as any user crosses the quota limit. The script in the background will take the unnecessary resources of server. I want the script will be invoked only when any user crosses the quota limit |
Your problem is that you have wrong expectations.
Quotas are checked by running: quotacheck -av So this has to be repeated once in a while (for example through cron; the sleep example is of no use I think, just check once every (10) minutes) Checking the quotas is not a realtime operation. It does only happen when you ask to do it. Depending on your output you can use the warnquota.conf configuration file to customize the mail sent to the user. Or you can write a script that parses the output of quotacheck -av and does the necessary things |
I'm just setting up quotas now, and am very happy with "warnquota -s".
I've added this command to a cron job that runs every night, so that when people come to work in the morning they have a bunch of quota warning mails to keep them busy for a while. :) |
All times are GMT -5. The time now is 06:26 PM. |