Industry guru Dave Taylor offers free tech support on a wide variety of technical and business topics, including HTML, Apple iPhone, online advertising, Cascading Style Sheets, Web design, management, Unix, Linux, search engine optimization, online dating, Mac OS X, shell script programming and Microsoft Windows.

How can I check disk quotas on my Verio VPS account?

I have a couple of clients who are on the same Verio/NTT Virtual Private Server (VPS) system, and I want to have some simple script to check their disk usage. It's not a simple "du" sort of task, however, because of the peculiarities of the VPS environment. Any ideas?


Dave's Answer:

Fortunately for you, VPS wizard Mark Sharkey of Precision Pros just recently published a great script that does just what you seek. Here's his introduction to the script:

I needed an easy way to check my servers for users approaching their diskquota, so, I put together a simple script based off Scott Wiersdorf's vlistuser. The script is called checkquota. It will display all users on the server that are using more than 80% of their disk quota. You can call this script with a cronjob so that an email is sent with a list of these users.

More information on the script can be found at Providertalk.com.

Here are the installation instructions:

You can find a copy of the source code: Checkquota.

Do this:

  1. Copy checkquota script to your server. You can do this by creating the file on your server and copy/paste the source code. Or, ftp the file. If you are ftp'ing the file, make sure you do it in ASCII.
  2. As root, save the file as /usr/local/sbin/checkquota and set permissions to 755.
  3. From an ssh command line, type 'rehash'
  4. From an ssh command line, run checkquota -h to view available options.

Note that if you're running bash or any other Bourne shell descendant you don't need to worry about step #3 here.

When you run the script, here's what you'll see:

$ checkquota -h usage: checkquota [options]

options:
-a show all users
-h show help
-o show only users over quota (this is the default)
-t change threshold percentage (default is 80)

You may also use the following "long-style" options to achieve the
same effects as above:

--all show all users
--help show help
--over show only users over quota (this is the default)
--threshold change the threshold percentage (default is 80)

Very nice job, and a great script to study if you want to learn more about shell script programming. Of course, you might also like to check out my book Wicked Cool Shell Scripts, but that's another story entirely! :-)



Help others find this article at Del.icio.us, Digg, Netscape, Reddit, and Stumble Upon    

Subscribe!

Never miss another useful Q&A article again! Subscribe to AskDaveTaylor with Google Reader.

Comments
Rather amazingly, there are no comments on this article yet.

I have something to say, now that you mention it, but ...
Starbucks coffee cup I do have a lot to say, and questions of my own for that matter, but first I'd like to say thank you for all your efforts on this Web site by buying you a cup of coffee!

I do have a comment, now that you mention it!











Remember personal info?


Please note that I will never send you any unsolicited email. Ever.

While I'm at it, please note that by submitting a question or comment you're agreeing to my terms of service, which are: you relinquish any subsequent rights of ownership to your material by submitting it on this site.








Ask Dave Taylor: The iPhone App: Advertisement



Follow me on Twitter @DaveTaylor

Search
Find just the answers you seek from among our 2300+ free tech support articles by using our Lijit search engine.


Linux Journal: Free Issue!

Help!





Subscribe to
Ask Dave Taylor!

Add to Google Reader
Add to My Yahoo!
Subscribe in NewsGator Online

RDF   XML

Free Updates!
Sign up and get free weekly updates and special offers on books, seminars, workshops and more.


Recent Entries
Book Links
© 2002 - 2010 by Dave Taylor. All Rights Reserved.

Note: This web site is for the purpose of disseminating information for educational purposes, free of charge, for the benefit of all visitors. We take great care to provide quality information. However, we do not guarantee, and accept no legal liability whatsoever arising from or connected to, the accuracy, reliability, currency or completeness of any material contained on this web site or on any linked site.

[whiteboard marker tray]
"Ask Dave Taylor®" is a registered trademark of Intuitive Systems, LLC.