Shell脚本之监控用户的quota用量

这一段脚本是用于监控用户的quota的。当然如果你稍稍修改也可以用于监控组的quota。独立成文章,以便日后查找。
#!/bin/bash
# this is used for monitor quota
# mode by cheng
# ctime 2010-11-16 16:35
user=`/usr/sbin/repquota -a | grep -v Block | grep -v device | grep -v root | \
awk -F " " '{print $1}' | grep -v User | grep -v -`
for i in `echo $user`
do
        u=`/usr/sbin/repquota -a | grep $i | awk -F " " '{print $3}'`
        if [ $u -gt 95000 ];then
                echo "You have reached the available space $u KB" | \
                mail -s "`date +%Y/%m/%d-%I:%M` Share Quota waring" $i
                echo "$i have reached the available space $u KB" | \
                mail -s "`date +%Y/%m/%d-%I:%M` badboy $i quota waring" root
        fi
done

你可能感兴趣的:(shell,职场,监控,休闲,quota)