scan-rt-user.sh
#! /bin/sh #export LC_ALL=zh_CN.GB18030 export LC_ALL=zh_CN.UTF-8 cd /bin2/ sh scan-rt-user-daily.sh > scan-rt-user-daily.sh.log 2>&1 /usr/bin/mutt -s "scan-rt-user-daily" scm-svr-mtr@scm5.***.cn < scan-rt-user-daily.sh.log
scan-rt-user-daily.sh
#!/bin/sh if [ -f scan-rt-user3.txt ] then rm -f scan-rt-user3.txt fi if [ -f scan-rt-user1.txt ] then rm -f scan-rt-user1.txt fi mysql -u root -p*** -e "use rt3; select Users.EmailAddress from Users, Principals where Principals.Disabled = '0' and Principals.PrincipalType like 'User' and Principals.id = Users.id into outfile 'scan-rt-user1.txt'"; #mysql -u root -e "use rt3; select EmailAddress from Users where Password not like '*NO-PASSWORD*' into outfile 'scan-rt-user1.txt'"; mv -f /var/lib/mysql/rt3/scan-rt-user1.txt . sed -i "/N/d" scan-rt-user1.txt sort scan-rt-user1.txt | uniq - scan-rt-user3.txt echo "***账号总数***" cat scan-rt-user3.txt | wc -l echo "." echo "***账号变化***" diff scan-rt-user3.txt scan-rt-user.txt cat scan-rt-user3.txt > scan-rt-user.txt echo "." echo "***账号不是集团的邮箱***" grep ';' scan-rt-user.txt grep -v -E '@***.com$|@***.com$|@***.com$|@***.com$|@***.com$|@***.com|@***.cn$|@***.com$|@***.cn$|@***.com$|@***.com$|@***.com.cn$|@***.com$|@***.cn$|@***.com$' scan-rt-user.txt echo "." echo "***账号没有mail***" mysql -u root -p*** -e "use rt3; select Users.Name,Users.EmailAddress from Users, Principals where Principals.Disabled = '0' and Principals.PrincipalType like 'User' and Principals.id = Users.id and Users.EmailAddress = ''";