文件: allstop.sh allstart.sh
路径 $HOME/ggscript/ggoperat
l运维OGG过程中,曾经遇到非数据同步运维同事需要配合数据库DBA维护启停所有数据同步链路的情况
因此特别编写了这两套全进程启停脚本,一套用于全进程停止,会调用长事务跳过脚本,跳过长事务,以及停止进程和MGR监控进程。一套用于全部OGG进程启动。
allstop.sh
#!/bin/bashecho $dircd $HOME/ggscript/ggoperatdir=$PWDcd $HOMEif [ -f .profile ];then . .profilefiif [ -f .bash_profile ];then . .bash_profileficd $direcho "All process will be stop! Are you sure will do this job?(press any key to continue)" select ch in "yes" "no"docase $ch in"yes") echo "execute the process stop operation" break; ;;"no") echo "process break" exit 2; ;;*) echo "Please select your choice :1.yes.2.no";; esacdone;cd $HOME/ggserver(echo info all;echo exit)|./ggsci|grep "EXTRACT" |awk 'BEGIN {FS=" +"} {print $3}'|grep '^E' > $dir/extract(echo info all;echo exit)|./ggsci|grep -E "EXTRACT|REPLICAT" |awk 'BEGIN {FS=" +"} {print $3}' > $dir/processcd $diri=1NUX=`sed -n '$=' extract`#if [ "$i" -le "$NUX" ];then while(($i<=$NUX)); do ext=`sed -n $i'p' extract` echo $ext /bin/bash $HOME/ggscript/ggtrandata/skip.sh $ext ((i++)); donecd $diri=1NUX=`sed -n '$=' process`echo "nux=$NUX"cat /dev/null > $HOME/ggserver/dirdat/stopwhile(($i<=$NUX)); do ext=`sed -n $i'p' process` echo $ext echo "stop $ext" >> $HOME/ggserver/dirdat/stop ((i++));donerm -f extractrm -f processcd $HOME/ggserver(echo obey dirdat/stop; echo exit)|./ggsci(echo stop mgr;echo y;echo exit)|./ggsci
allstart.sh
#!/bin/bashecho $dircd $HOME/ggscript/ggoperatdir=$PWDcd $HOMEif [ -f .profile ];then . .profilefiif [ -f .bash_profile ];then . .bash_profileficd $dircd $HOME/ggserver(echo START mgr;echo exit)|./ggsci(echo info all;echo exit)|./ggsci|grep "EXTRACT" |awk 'BEGIN {FS=" +"} {print $3}' > $dir/process(echo info all;echo exit)|./ggsci|grep "REPLICAT" |awk 'BEGIN {FS=" +"} {print $3}' >> $dir/processcd $diri=1NUX=`sed -n '$=' process`while(($i<=$NUX)); do ext=`sed -n $i'p' process` echo $ext /bin/bash $HOME/ggscript/ggoperat/start.sh $ext ((i++));done