Jun 18, 2011

Sample Script to Report /home Directory Usage

So, awhile back, I created this simple script to monitor usage of the /home directory on a GNU/Linux server. I've been working on it a bit more lately and I figured it's time to share it. The script is configurable to check for "certain" files in a user's directory (i.e., .iso, .mp3, .etc), has a minimum reporting threshold setting, and outputs to a file.

Keep an eye out for crazy numbers because I'm seeing differences in the way the find and du commands report, depending on their versions. So if you see some weird reporting situation, let me know so I can address the problem.

Using user quotas on server would probably be just as effective but what can I say, I like a challenge.

Note: before you light your torches, I don't claim to be a bash scripting expert (not yet anyways). So if anyone has any "constructive" criticism, please feel free to leave a comment.

The script is GPL (of course), so please feel free to use any part of it (or the whole thing) as you wish.

Here's a link to download the file:
UserUsageReport.tar.gz
sha1sum: eba4b49a75602240659ac45a5f4eef3e14d7f402

Enjoy.

Shannon VanWagner