LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 07-15-2009, 11:22 PM   #1
sushantchawla2005
Member
 
Registered: Jun 2009
Location: India
Distribution: All flavours of linux
Posts: 93

Rep: Reputation: 14
Exclamation 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
 
Old 07-15-2009, 11:42 PM   #2
vikas027
Senior Member
 
Registered: May 2007
Location: Sydney
Distribution: RHEL, CentOS, Ubuntu, Debian, OS X
Posts: 1,305

Rep: Reputation: 107Reputation: 107
Thumbs up

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.
 
Old 07-16-2009, 01:16 AM   #3
sushantchawla2005
Member
 
Registered: Jun 2009
Location: India
Distribution: All flavours of linux
Posts: 93

Original Poster
Rep: Reputation: 14
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.
 
Old 07-16-2009, 03:34 AM   #4
vikas027
Senior Member
 
Registered: May 2007
Location: Sydney
Distribution: RHEL, CentOS, Ubuntu, Debian, OS X
Posts: 1,305

Rep: Reputation: 107Reputation: 107
Quote:
Originally Posted by sushantchawla2005 View Post
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.


.
 
Old 07-16-2009, 04:28 AM   #5
sushantchawla2005
Member
 
Registered: Jun 2009
Location: India
Distribution: All flavours of linux
Posts: 93

Original Poster
Rep: Reputation: 14
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
 
Old 07-16-2009, 06:22 AM   #6
vikas027
Senior Member
 
Registered: May 2007
Location: Sydney
Distribution: RHEL, CentOS, Ubuntu, Debian, OS X
Posts: 1,305

Rep: Reputation: 107Reputation: 107
Quote:
Originally Posted by sushantchawla2005 View Post
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.
 
Old 07-16-2009, 06:26 AM   #7
sushantchawla2005
Member
 
Registered: Jun 2009
Location: India
Distribution: All flavours of linux
Posts: 93

Original Poster
Rep: Reputation: 14
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
 
Old 07-16-2009, 08:20 AM   #8
deadeyes
Member
 
Registered: Aug 2006
Posts: 609

Rep: Reputation: 79
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
 
Old 08-18-2009, 07:12 AM   #9
kenneho
Member
 
Registered: May 2003
Location: Oslo, Norway
Distribution: Ubuntu, Red Hat Enterprise Linux
Posts: 657

Rep: Reputation: 40
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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
mod_status reporting number of processes exceeding MaxClients thetawaverider Linux - Server 1 02-28-2007 11:14 PM
Apache processes exceeding MaxClients thetawaverider Linux - Software 4 02-28-2007 11:11 PM
Problem exceeding max number of X connections Maldain Mandriva 2 05-05-2005 10:21 AM
Script to set different quota depending on User's Group ID TechNett Programming 6 08-09-2004 02:45 PM
Programs exceeding my screen HadesThunder Linux - Newbie 7 05-17-2004 06:07 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 06:22 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration