OGG operation and maintenance optimization script (14)-Information synchronization class-definition files are automatically issued
File: resend.sh
Path: $HOME/ggscript/ggdef
Function: this script is designed to deal with the abnormal interruption of the process caused by the failure of the definition file on the target side.
Because the source business often does not notify the target end and the system group to modify the table structure on its own.
Therefore, the script is designed to automatically generate the definition file and send it to the corresponding path of the specified target machine for normal reading of the target machine REPLICATE process.
Log path: $HOME/gglog/ggupload
#! / bin/bashcd $HOMEif [- f. Profile]; then. Profilefiif [- f. Bash _ profile]; then. .bash _ profilefiif [$#-eq 0]; then echo "info defprm" exit 2fimydate = `date + 20%y-%m-%d-%H:% M`filename = $1cd $HOME/ggserver/dirdefif [!-d bak]; then mkdir bak & & echo "Directory bak created." | | echo "Error: Failed to create directory $dr." else echo "bak directory exits!" ficd $HOME/ggserver/dirprmif [!-e $filename]; then echo "the file is not exist!" Exit 2ficat $filename > $HOME/ggscript/ggdef/tempdefsfile= `cat $HOME/ggscript/ggdef/temp | grep DEFSFILE | cut-d'/'- f 3`target = `cat $HOME/ggscript/ggdef/temp | grep TARGET: | cut-d':'- f 2`release = `cat $HOME/ggscript/ggdef/temp | grep RELEASE: | cut-d':'- f 2`echo $defsfile $target $releasecd $HOME/ggserver/dirdefif [- d `defsfile`]; then mv $defsfile bak/$defsfile ficd $HOME/ggserverif ["$release" = "10.4"] Then $HOME/gg104/defgen paramfile $HOME/ggserver/dirprm/$filename else. / defgen paramfile $HOME/ggserver/dirprm/$filenameficd $HOME/ggserver/dirdefecho $target $defsfilesize= `cat $defsfile | wc-c`ech o $size#exec / bin/bash $HOME/ggscript/ggupload/upload.sh $target $HOME/ggserver/dirdef/$defsfile sysinfoif [$size-le 1000]; then exit 2else / bin/bash $HOME/ggscript/ggupload/upload.sh $target $HOME/ggserver/dirdef/$defsfile sysinfofi