LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Script for Exceeding Quota (https://www.linuxquestions.org/questions/linux-server-73/script-for-exceeding-quota-740415/)

sushantchawla2005 07-15-2009 11:22 PM

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

vikas027 07-15-2009 11:42 PM

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.

sushantchawla2005 07-16-2009 01:16 AM

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.

vikas027 07-16-2009 03:34 AM

Quote:

Originally Posted by sushantchawla2005 (Post 3609097)
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.

Strange, this should work. Give the details of you OS.

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.


.

sushantchawla2005 07-16-2009 04:28 AM

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

vikas027 07-16-2009 06:22 AM

Quote:

Originally Posted by sushantchawla2005 (Post 3609282)
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

Could you please attach or paste repquota -a output here.

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.

sushantchawla2005 07-16-2009 06:26 AM

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

deadeyes 07-16-2009 08:20 AM

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

kenneho 08-18-2009 07:12 AM

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.