Users who crawl storage quota more than 80%

Source: Internet
Author: User

Crawl storage quota more than 80% of the AD domain users


Note:

1, Asperadata for the storage volume name, Ming for the domain name

2, by the MING to replace (empty), and then delete the "\", the remaining is the name after the domain name (full domain name such as: Ming\zhi.yang)


#!/bin/bash


Date= ' Date +%y%m%d '

date2= ' Date +%y%m%d-d ' 7 days ago '


Dir=/tools/aspera


/BIN/RM-RF $Dir/users_use.txt

/BIN/RM-RF $Dir/used.txt

/BIN/RM-RF $Dir/warn_$date2.txt

/usr/bin/touch $Dir/users_use.txt

/usr/bin/touch $Dir/used.txt

/usr/bin/touch $Dir/warn_$date.txt


SSH 10.0.0.40 "Quota report-x" | grep asperadata > $Dir/aspera.txt


/bin/cat $Dir/aspera.txt | awk-f[: "]+ ' {print $} ' | grep MING > $Dir/users2.txt

Sed-i ' s/ming//g ' $Dir/users2.txt

Tr-d ' \ ' $Dir/users.txt

/bin/cat $Dir/users2.txt | tr-d ' \ ' > $Dir/users.txt


For i in ' Cat $Dir/users.txt '

Do

Used= ' Cat $Dir/aspera.txt | grep $i | awk-f[: "]+ ' {print $} '

Total= ' Cat $Dir/aspera.txt | grep $i | awk-f[: ""]+ ' {print $6} '

/bin/echo $i, $Used, $Total >> $Dir/users_use.txt

/bin/echo $Used >> $Dir/used.txt

Done


For II in ' Cat $Dir/used.txt '

Do

If [$ii-gt 83880000] && [$ii-lt 104857600];then

/bin/cat $Dir/users_use.txt | grep $ii >> $Dir/warn_$date.txt

Fi

If [$ii-gt 167770000] && [$ii-lt 209715200];then

/bin/cat $Dir/users_use.txt | grep $ii >> $Dir/warn_$date.txt

Fi

Done


/usr/bin/scp-r $Dir/warn_$date.txt [email protected]:/log/aspera/


This article is from the "Linux" blog, so be sure to keep this source http://yangzhiming.blog.51cto.com/4849999/1891656

Users who crawl storage quota more than 80%

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.