Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2011-02-22
5
Medium Priority
?
569 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 40

Accepted Solution

by:
omarfarid earned 1000 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The following is a collection of cases for strange behaviour when using advanced techniques in DOS batch files. You should have some basic experience in batch "programming", as I'm assuming some knowledge and not further explain the basics. For some…
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 …
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…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Suggested Courses

609 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