OGG运维优化脚本(十八)-进程操作类--全进程启停
文件: allstop.sh allstart.sh
创新互联建站是专业的文水网站建设公司,文水接单;提供成都做网站、成都网站设计,网页设计,网站设计,建网站,PHP网站建设等专业做网站服务;采用PHP框架,可快速的进行文水网站开发网页制作和功能扩展;专业做搜索引擎喜爱的网站,专业的做网站团队,希望更多企业前来合作!
路径 $HOME/ggscript/ggoperat
l运维OGG过程中,曾经遇到非数据同步运维同事需要配合数据库DBA维护启停所有数据同步链路的情况
因此特别编写了这两套全进程启停脚本,一套用于全进程停止,会调用长事务跳过脚本,跳过长事务,以及停止进程和MGR监控进程。一套用于全部OGG进程启动。
allstop.sh
#!/bin/bash echo $dir cd $HOME/ggscript/ggoperat dir=$PWD cd $HOME if [ -f .profile ];then . .profile fi if [ -f .bash_profile ];then . .bash_profile fi cd $dir echo "All process will be stop! Are you sure will do this job?(press any key to continue)" select ch in "yes" "no" do case $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" ;; esac done; 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/process cd $dir i=1 NUX=`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++)); done cd $dir i=1 NUX=`sed -n '$=' process` echo "nux=$NUX" cat /dev/null > $HOME/ggserver/dirdat/stop while(($i<=$NUX)); do ext=`sed -n $i'p' process` echo $ext echo "stop $ext" >> $HOME/ggserver/dirdat/stop ((i++)); done rm -f extract rm -f process cd $HOME/ggserver (echo obey dirdat/stop; echo exit)|./ggsci (echo stop mgr;echo y;echo exit)|./ggsci
allstart.sh
#!/bin/bash echo $dir cd $HOME/ggscript/ggoperat dir=$PWD cd $HOME if [ -f .profile ];then . .profile fi if [ -f .bash_profile ];then . .bash_profile fi cd $dir cd $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/process cd $dir i=1 NUX=`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
网页标题:OGG运维优化脚本(十八)-进程操作类--全进程启停
文章来源:http://lswzjz.com/article/gjhioo.html