
hacker01
Novice
Apr 12, 2007, 9:32 AM
Post #2 of 2
(1786 views)
|
|
Re: [tsreddy02] Disk usage in Linux
[In reply to]
|
Can't Post
|
|
The process is much simpler that you may think. You don't need to call the modules. you can do it lik this. opendir DIR, "/home"; @alldirectories = readdir DIR; foreach $directory(@alldirectories) { $diskusage = `du -s $directory`; $totalusage = ($totalusage + $diskusage); $diskusage = ""; } if ($totalusage > $maxspace){&emailme;} Just run that from a cron file or incorporate that into a perl server monitring script that runs at some interval. http://bumblebeeware.com/monitor/ I figure you can set up the email part. Just be careful of overhead I am not sure how much the summary switch uses. But the summary will allow you to identify the user that is the biggest offendor.
|