Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

OGG Operation and maintenance Optimization script (17)-Information synchronization Class-configuration backup

2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

File name: ggbackup.sh

Path $HOME/ggscript/ggbackup

In the second half of 2016, one of our data synchronization servers was forced to redeploy due to the loss of OGG configuration files due to storage corruption. Therefore, a script for automatically backing up OGG process configuration information is written especially for this situation.

#! / bin/bashcd $HOME/ggscript/ggbackupdir=$PWDcd $HOMEif [- f. Profile]; then. Profilefiif [- f. Bash _ profile]; then. .bash _ profilefimydate= `date + 20% ycombe% mMUE% H`hn = `echo $HSTNAME`usr = `echo $hn-$ usr`cd $direcho $dirif [!-d $dr]; then mkdir $dr & & echo "Directory $hn-$user created." | echo "Error: Failed to create directory $dr." else echo "$dr directory exits!" fiif [!-d $dr/dirprm] Then mkdir $dr/dirprm & & echo "Directory $dr/dirprm created." | | echo "Error: Failed to create directory $dr/dirprm." else echo "$dr/dirprm directory exits!" fiif [!-d $dr/dirpcs]; then mkdir $dr/dirpcs & & echo "Directory $dr/dirpcs created." | echo "Error: Failed to create directory $dr/dirpcs." else echo "$dr/dirpcs directory exits!" fiif [!-d $dr/info] Then mkdir $dr/info & & echo "Directory $dr/info created." | | echo "Error: Failed to create directory $dr/info." else echo "$dr/info directory exits!" ficd $HOME/ggserver (echo info all) Echo exit) |. / ggsci | grep-E "EXTRACT | REPLICAT" | awk 'BEGIN {FS= "+"} {print $3}' > $HOME/ggscript/ggbackup/tempnum= `sed-n'$dir/ temp`i = 1while ["$I"-le "$num"] do VAR= `sed-n $itemp' $dir/ temp` # echo $VAR var= `echo $VAR | tr "[: upper:]" [: lower:] "`# echo $var find $HOME/ggserver/dirprm-name $var.prm-exec cp {} $dir/$dr/dirprm/\ Find $HOME/ggserver/dirpcs-name $VAR.pc*-exec cp {} $dir/$dr/dirpcs/\; (echo info $VAR;echo exit) |. / ggsci > $dir/$dr/info/$VAR I = `expr $I + 1`find $HOME/ggserver/dirprm-name mgr.prm-exec cp {} $dir/$dr/dirprm/\; find $HOME/ggserver/dirpcs-name MGR.pc*-exec cp {} $dir/$dr/dirpcs/\ (echo exit) |. / ggsci | grep Oracle > $dir/$dr/version (echo exit) |. / ggsci | grep Version > > $dir/$dr/versioncd $dirzip-r $dr.zip $dr/bin/bash $HOME/ggscript/ggupload/upload.sh backup $dir/$dr.zip sysinfo

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report