文件名:search.sh
宿松网站建设公司创新互联,宿松网站设计制作,有大型网站制作公司丰富经验。已为宿松数千家提供企业网站建设服务。企业网站搭建\成都外贸网站建设公司要多少钱,请找那个售后服务好的宿松做网站的公司定做!
路径:$HOME/ggscript/ggsearch
功能:该脚本用于满足检查goldengate进程具体配置情况的需求而设计
通过edit脚本选择调用
#!/bin/bash echo "This script is used to search the specified table!(created by renyi)" echo $dir dir=$PWD cd $HOME/ggserver #确定搜索对象类型 echo "Please select the search type" echo select ch in "ALLFILE" "EXTRACT" "REPLICAT" "PUMP" do case $ch in "ALLFILE") ls -lrt $HOME/ggserver/dirprm/*.prm #获取进程清单 cd $HOME/ggserver (echo info all;echo exit)|./ggsci cd $dir val=1 break; ;; #针对对应类型 进行搜索操作 #输入需搜索的进程文件名 "EXTRACT") ls -lrt $HOME/ggserver/dirprm/e*.prm cd $HOME/ggserver (echo info all;echo exit)|./ggsci cd $dir read -p "Please enter the prm file name:" val break; ;; "REPLICAT") ls -lrt $HOME/ggserver/dirprm/r*.prm cd $HOME/ggserver (echo info all;echo exit)|./ggsci cd $dir read -p "Please enter the prm file name:" val break; ;; "PUMP") ls -lrt $HOME/ggserver/dirprm/p*.prm cd $HOME/ggserver (echo info all;echo exit)|./ggsci cd $dir read -p "Please enter the prm file name:" val break; ;; *) echo "Please select your choice : 1.ALLFILE 2.EXTRACT 3.REPLICAT 4.PUMP" ;; esac done; echo "Please Enter the table you want to search!" read -n 1 vi SearchTemp i=1 num=`sed -n '$=' SearchTemp` if [ "$val" == 1 ] then while [ "$i" -le "$num" ] do TAL=`sed -n $i'p' SearchTemp` grep -ni $TAL $HOME/ggserver/dirprm/* 1>> exist || echo $TAL >> notexist ((i++)); done else while [ "$i" -le "$num" ] do TAL=`sed -n $i'p' SearchTemp` grep -ni $TAL $HOME/ggserver/dirprm/$val 1>> exist || echo $TAL >> notexist ((i++)); done fi #输出搜索结果 echo "---------------------------------------" echo "The search result is" cat exist echo "---------------------------------------" echo "The not exist table is" cat notexist echo "---------------------------------------" cat SearchTemp | sort -n > SearchTempu cat notexist | sort -n > notexistu comm -23 SearchTempu notexistu > existable cat /dev/null > exist cat /dev/null > SearchTemp cat /dev/null > notexist echo "The exist table is" cat existable exit