[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 571
  • Last Modified:

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

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
wasman
Asked:
wasman
  • 3
  • 2
1 Solution
 
omarfaridCommented:
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
 
wasmanAuthor Commented:
$ 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
 
omarfaridCommented:
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
 
wasmanAuthor Commented:
my OS is
$ cat /etc/*release
Red Hat Enterprise Linux AS release 4 (Nahant Update 7)
0
 
wasmanAuthor Commented:
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.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now