I'm trying to create a script that will monitor all non-admin user home directories under /HOME for growth of over 100MB in a 20 min period, and send an email to root if this occurs. The email needs to contain a list of users that were found in violation of this.
I'm rather new to Unix, and I can easily write pseudo code for this, but translating it into code is proving to be a difficulty. I'm thinking it would go something like this:
For (all folders under /HOME) {
- store folder size in a variable
- store current timestamp in a variable
- when time += 20 min, get new folder size and compare
if (new size - old size > 100+)
- send email notification to root with offending username
else (exit)
}
Any help would be greatly appreciated! I'm really struggling with this.