du cut tr send email notification overquota users in an old mail system linux accounts

Task : to email old users that they have exceeded 100m disk space
The problem is that the folder where the user is deep inside 2 folders so "du" is used.

tr is used to remove characters

cut to get the coloumn
http://stackoverflow.com/questions/11049748/how-to-cut-multiple-columns-from-several-files-and-print-the-ouput-to-different

 

cd /backup/home/virtual
du -m --max-depth=2  | tr './' ' ' | cut -d' '  -f 1,4 | while read space user

do

   if [ $space -gt 100 ]
                    then

        mail -s "Your account is using over 100MB Disk Space" $user <<MAIL

 $user:

You are now using $space MB in your home directory.
The only total amount of diskspace allowed is 100 MB.

MAIL
 fi


done

Comments

Popular posts from this blog

Black screen after logging in on Windows 2012 R2 using domain credentials on remote desktop connection

Client denied by server configuration error

Water Wonder Resort