Industry guru Dave Taylor answers free tech support questions about a wide variety of business and technical topics, including blogging, Google AdSense, MySpace, Sony PSP, Apple iPod, Mp3 players, management, Linux, SEO, Mac OS X, Facebook, Twitter, LinkedIn 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 Simpy.

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 a lot to say, but ...
Starbucks coffee cup I have a lot to say, and questions of my own for that matter, but most of all I'd like to say thank you for all your efforts on this Web site by buying you a chai!

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









Remember personal info?


Please note that I will never send you any unsolicited commercial 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.









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


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
Join the List!
Join my author info mailing list, where you'll learn about my upcoming books, speaking gigs, and more!


Book Links
© 2002 - 2008 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]