Unix Bash脚本 - 监控用户主目录增长

时间:2014-07-27 22:21:09

标签: bash unix time size system-administration

我正在尝试创建一个脚本,该脚本将监视/ HOME下的所有非管理员用户主目录,在20分钟内增长超过100MB,如果发生这种情况,则向root发送电子邮件。电子邮件需要包含违反此规定的用户列表。

我对Unix很新,我可以轻松地为此编写伪代码,但将其转换为代码证明是一个难题。我想它会是这样的:

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)
}

任何帮助将不胜感激!我真的很挣扎。

1 个答案:

答案 0 :(得分:1)