scan-cvs-pga.sh
#! /bin/sh export LC_ALL=zh_CN.UTF-8 cd /bin2/ sh scan-cvs-pga-daily.sh > scan-cvs-pga-daily.sh.log 2>&1 mutt -s "scan-cvs-pga-daily" scm-svr-mtr@scm5.***.cn < scan-cvs-pga-daily.sh.log
scan-cvs-pga-daily.sh
#! /bin/sh echo "***检查passwd/group/access文件不规范情况...***" echo . echo .access定义不对. find /cvsroot/ -follow -name access -exec grep -E -v "^d:|^#|^$" {} ; -print find /cvsroot/ -follow -name access -exec grep -E -v "^#|:$|^$" {} ; -print find /cvsroot/ -follow -name access -exec grep ",!" {} ; -print find /cvsroot/ -follow -name access -exec grep "//" {} ; -print find /cvsroot/ -follow -name access -exec grep "!," {} ; -print find /cvsroot/ -follow -name access -exec grep "!/" {} ; -print find /cvsroot/ -follow -name access -exec grep "," {} ; -print echo . echo .passwd定义不对. find /cvsroot/ -follow -name passwd -exec grep -v .*:.* {} ; -print echo . echo .有特殊符号~. find /cvsroot/ -follow -name passwd -exec grep '~' {} ; -print find /cvsroot/ -follow -name group -exec grep '~' {} ; -print find /cvsroot/ -follow -name access -exec grep '~' {} ; -print echo . echo .有空行. find /cvsroot/ -follow -name passwd -exec grep ^$ {} ; -print find /cvsroot/ -follow -name group -exec grep ^$ {} ; -print find /cvsroot/ -follow -name access -exec grep ^$ {} ; -print echo . echo .行尾有逗号. find /cvsroot/ -name group -follow -exec grep ,$ {} ; -print echo . echo .有双逗号. find /cvsroot/ -name group -follow -exec grep ,, {} ; -print echo . echo .行头行尾有空格. find /cvsroot/ -name group -follow -exec grep -E '^ | $' {} ; -print find /cvsroot/ -name passwd -follow -exec grep -E '^ | $' {} ; -print find /cvsroot/ -name access -follow -exec grep -E '^ | $' {} ; -print echo . echo .有双冒号. find /cvsroot/ -name group -follow -exec grep :: {} ; -print find /cvsroot/ -name passwd -follow -exec grep :: {} ; -print find /cvsroot/ -name access -follow -exec grep :: {} ; -print echo . echo .行中有#号. find /cvsroot/ -name group -follow -exec grep .*:.*#.* {} ; -print find /cvsroot/ -name passwd -follow -exec grep ^[^#].*#.* {} ; -print find /cvsroot/ -name access -follow -exec grep .*:.*#.* {} ; -print echo . echo .行中有@号. find /cvsroot/ -name group -follow -exec grep .*:.*@.* {} ; -print find /cvsroot/ -name passwd -follow -exec grep .*@.* {} ; -print find /cvsroot/ -name access -follow -exec grep .*:.*@.* {} ; -print echo . echo .有windows回车符. find /cvsroot/ -name group -follow -exec grep {} ; -print find /cvsroot/ -name passwd -follow -exec grep {} ; -print find /cvsroot/ -name access -follow -exec grep {} ; -print