Solved

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

Posted on 2011-02-23
3
592 Views
Last Modified: 2012-05-11
please provide me a simple bash script which will check the user quota, 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
  • 2
3 Comments
 
LVL 23

Accepted Solution

by:
Maciej S earned 500 total points
ID: 34968033
Name it for example: check_quota.sh, add +x permission, and run: check_quota.sh user_name (for example: check_quota.sh penn).
#!/bin/sh

USER=$1
LIMIT=250000

Q=`sudo -u ${USER} quota | tail -n1 | awk '{print $2}'`
if [ "${Q}" -gt "${LIMIT}" ]; then
   echo "User: ${USER}; quota exceeded" | mailx -s "quota exceeded" webadmin aa12erp aa13nbc
fi

Open in new window

0
 
LVL 23

Assisted Solution

by:Maciej S
Maciej S earned 500 total points
ID: 34968036
My mistake - replace print $2 with print $1
0
 

Author Closing Comment

by:wasman
ID: 34974516
Thanks a lot for helping me
0

Featured Post

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

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

In this tutorial I will show you how to make a simple HTML bar chart with the usage of WhizBase, If you want more information about WhizBase please read my previous articles at http://www.experts-exchange.com/ARTH_5123186.html (http://www.experts-ex…
This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
Learn the basics of lists in Python. Lists, as their name suggests, are a means for ordering and storing values. : Lists are declared using brackets; for example: t = [1, 2, 3]: Lists may contain a mix of data types; for example: t = ['string', 1, T…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

628 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