Get the App
SLTechnology News&Howtos  ›  Database  › 

OGG Operation and maintenance Optimization script (19)-process Operation Class-Auxiliary Operation

Shulou Source: shulou.com Published: 2022-06-01 10:49:15 09月20日 Update

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

Tags: Scripts status processes convenience frequency aliases functions at the same time files sometimes interfaces systems paths switching running auxiliary Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno OPPO Reno Linux Apple Redmi Huawei