OGG Operation and maintenance Optimization script (19)-process Operation Class-Auxiliary Operation
File: info.sh start.sh stop.sh
Path $HOME/ggscript/ggoperat
Because after writing too many scripts, sometimes in order to check the running status of OGG, I have to switch frequently between GGSCI and the system interface, so for convenience, I wrote a few relatively simple scripts, together with alias aliases, to simulate the info start stop function in ggsci. At the same time, these scripts can also be called by other scripts to operate or get the process status.
Info.sh
#! / bin/bashif [$#-eq 0]; then echo "INFO EXTRACT" exit 2fiecho $dircd $HOME/ggscript/ggoperatdir=$PWDcd $HOMEif [- f. Profile]; then. Profilefiif [- f. Bash _ profile]; then. .bash _ profileficd $dirbackuptime= `date +% Y% m% dmurf% H% M% S`val = $1vale = `echo $val | tr Amurz A-Z`if [`echo $val | grep ^ E`]; then IType=EXTRACTelif [`echo $val | grep ^ P`]; then IType=POSTelif [`echo $val | grep ^ R`]; then IType=REPLICAT else echo "only can operate the EXTRACT REPLICAT and the POST process" exit 2fipro` = `echo $val.PRM | tr Amurz-z`cd $HOME/ggserver/dirprmif [!-e $pro] Then echo "the PROCESS is not exist" exit 2fi#cd $HOME/ggscript/ggoperatcd $HOME/ggserver (echo INFO $val;echo exit) |. / ggsci
Start.sh
#! / bin/bashif [$#-eq 0]; then echo "START EXTRACT" exit 2fiecho $dircd $HOME/ggscript/ggoperatdir=$PWDcd $HOMEif [- f. Profile]; then. Profilefiif [- f. Bash _ profile]; then. .bash _ profileficd $dirbackuptime= `date +% Y% m% dmurf% H% M% S`val = $1vale = `echo $val | tr Amurz A-Z`if [`echo $val | grep ^ E`]; then IType=EXTRACTelif [`echo $val | grep ^ P`]; then IType=POSTelif [`echo $val | grep ^ R`]; then IType=REPLICAT else echo "only can operate the EXTRACT REPLICAT and the POST process" exit 2fipro` = `echo $val.PRM | tr Amurz-z`cd $HOME/ggserver/dirprmif [!-e $pro] Then echo "the PROCESS is not exist" exit 2fi#cd $HOME/ggscript/ggoperatcd $HOME/ggserver (echo START $val;echo exit) |. / ggsci
Stop.sh
#! / bin/bashif [$#-eq 0]; then echo "STOP EXTRACT" exit 2fiecho $dircd $HOME/ggscript/ggoperatdir=$PWDcd $HOMEif [- f. Profile]; then. Profilefiif [- f. Bash _ profile]; then. .bash _ profileficd $dirbackuptime= `date +% Y% m% dmurf% H% M% S`val = $1vale = `echo $val | tr Amurz A-Z`if [`echo $val | grep ^ E`]; then IType=EXTRACTelif [`echo $val | grep ^ P`]; then IType=POSTelif [`echo $val | grep ^ R`]; then IType=REPLICAT else echo "only can operate the EXTRACT REPLICAT and the POST process" exit 2fipro` = `echo $val.PRM | tr Amurz-z`cd $HOME/ggserver/dirprmif [!-e $pro] Then echo "the PROCESS is not exist" exit 2fi#cd $HOME/ggscript/ggoperatcd $HOME/ggserver (echo STOP $val;echo exit) |. / ggsci