Solved

Check the user quota, if it excceds send email to user accounts

Posted on 2011-02-22
5
554 Views
Last Modified: 2012-05-11
please provide me a simple bash script which will check the user quote, if it exceeds more then 250mb, then it will trigger an email to user accounts --> webadmin, aa12erp and aa13nbc

$ sudo -u penn quota
Disk quotas for user penn (uid 1001734):
     Filesystem  blocks   quota   limit   grace   files   quota   limit   grace
/dev/01
                  45800  200000 3000000              25       0       0


]$ uname -a
Linux test012.6.9-89.0.23. #1 SMP Fri Mar 5 18:01:22 EST 2010 i686 i686 i386 GNU/Linux


i am going to setup a cronjob to excute this shell script every one hour
0
Comment
Question by:wasman
  • 3
  • 2
5 Comments
 
LVL 40

Accepted Solution

by:
omarfarid earned 500 total points
ID: 34958542
you can always do

q=`sudo -u penn quota | tail -1 | cut -f 3`
s=`expr $q / 2048`

then you can compare $s if greater than 250
0
 

Author Comment

by:wasman
ID: 34961667
$ q=`sudo -u loslsr quota | tail -1 | cut -f 3`
$ echo $q
48716 200000 3000000 26 0 0
$ s=`expr $q / 2048`
expr: syntax error
Please help
0
 
LVL 40

Expert Comment

by:omarfarid
ID: 34964504
from your quota command output the 3rd field is 300000 and cut should have returned that number

I do not know why it is returning the whole line
0
 

Author Comment

by:wasman
ID: 34965234
my OS is
$ cat /etc/*release
Red Hat Enterprise Linux AS release 4 (Nahant Update 7)
0
 

Author Closing Comment

by:wasman
ID: 34974565
Thanks for trying
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

How to remove superseded packages in windows w60 or w61 installation media (.wim) or online system to prevent unnecessary space. w60 means Windows Vista or Windows Server 2008. w61 means Windows 7 or Windows Server 2008 R2. There are various …
Utilizing an array to gracefully append to a list of EmailAddresses
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now