OGG运维优化脚本(九)-查询维护类--进程重复表检查
路径:$HOME/ggscript/ggrepeat
景洪ssl适用于网站、小程序/APP、API接口等需要进行数据传输应用场景,ssl证书未来市场广阔!成为成都创新互联公司的ssl证书销售渠道,可以享受市场价格4-6折优惠!如果有意向欢迎电话联系或者加微信:18980820575(备注:SSL证书合作)期待与您的合作!
功能:该脚本为处理目标端因为源端重复配置源端表,导致目标端数据重复的问题而设计。可以针对进程检查重复配置的表名,并罗列具体信息和所在文件行数
可以配合note快速注释脚本进行源端重复表清理操作
#!/bin/bash echo "+--------------------------------------------------------+" echo "|This script will search for the repeat table ( by RenYi)|" echo "+--------------------------------------------------------+" if [ $# -eq 0 ]; then echo "REPEAT EXTRACT" exit 2 fi backuptime=`date +%Y%m%d-%H%M` datenow=`date +%Y%m%d%H` val=$1 val=`echo $val|tr a-z A-Z` echo "-------------------------" echo "The process name is $val" echo "-------------------------" val=`echo $val.PRM|tr A-Z a-z` cd $HOME/ggserver/dirprm if [ ! -e $val ]; then echo "the EXTRACT is not exist" exit 2 fi cd $HOME/ggscript/ggrepeat cat $HOME/ggserver/dirprm/$val|awk '/TABLE#/,/#TABLE/{if(i>1)print x;x=$0;i++}' > temp awk -F '--' '($1) { print $1}' temp > temp2 rm -rf temp sed -e '/^$/d' temp2 > temp3 rm -rf temp2 awk -F ',' '{print $1}' temp3 >temp4 rm -rf temp3 awk -F ';' '{print $1}' temp4 >temp5 rm -rf temp4 cat temp5|awk -F 'TABLE ' '{print $2}' > Temp rm -rf temp5 sort Temp |uniq -d > $HOME/ggscript/ggrepeat/tmp echo "-------------------------" echo "The repeat table:" echo "-------------------------" cat tmp i=1 num=`sed -n '$=' tmp` echo "num = $num" echo "-------------------------" echo "The Detailed results:" echo "-------------------------" while [ ! -n "$num" ] do echo "no result" exit 2 done while [ "$i" -le "$num" ] do TAL=`sed -n $i'p' tmp` echo $TAL grep -ni $TAL $HOME/ggserver/dirprm/$val ((i++)); done echo "-------------------------"
本文名称:OGG运维优化脚本(九)-查询维护类--进程重复表检查
URL地址:http://azwzsj.com/article/pphjpj.html