[techtalk] disk space monitoring?
Erin Clarke
blue at web.net
Mon Apr 17 12:36:24 EST 2000
I dunno about the best or most efficient, but...
On Mon, Apr 17, 2000 at 08:28:34AM -0700, alissa bader wrote:
> What's the best way to monitor disk space usage? Ok,
> the most efficient way to monitor disk space usage? I
> do a du and it lists all of the files being used. I'm
> looking for something that just mentions the specific
> directories that are taking up the most space.
>
> Surely a script of some nature must be in order...but
> being rather new to this scripting stuff, I'm even
> more at a loss.
...I use a small script from the directory in question...
du -s * | sort -rn | head -40 > piggy.list
...most often just at the commandline, but for specific filesystems,
like keeping track of mail folders, website dirs or logs, I use a
script to mail me the output and add it to the cron table to run once
a week (or whatever).
So, for example,
----------
#!/bin/sh
# mail list of 20 largest mailboxes
IFS='
'
PATH=/bin:/usr/bin:/usr/local/bin
host=`hostname`
cd /var/mail
du -s * | sort -rn | head -20 | Mail -s "$host: 20 biggest mailboxes" myself at mydomain.net
----------
...and have it run as a cron job.
0 3 * * 1 /local/sbin/maildu.sh
Hope that helps!
Erin 8)
--
Erin Clarke
SysAdmin-y Type,
Doer of Many Things
More information about the Techtalk
mailing list