Get the App
SLTechnology News&Howtos  ›  Database  › 

OGG Operation and maintenance Optimization script (5)-Information Modification Class-batch comments

Shulou Source: shulou.com Published: 2022-06-01 15:24:38 11月16日 Update

File name: comment.sh

Path: $HOME/ggscript/ggcomment

Function: the script is designed based on the database monthly large number of annotated source tables for data cleaning, requiring data synchronization with a large number of annotated configuration tables.

Select and call through the edit script

Log path: $HOME/gglog/ggcomment

#! / bin/bashbackuptime= `date +% Y% m% dmurf% H% M`echo "This script is used to annotate the specified table! (created by renyi)" echo $backuptime >''$HOME'/gglog/ggcomment/InsertLog-'$backuptime'.log'read-n process "enter the filename of the E process that requires batch comments (at the end of prm) ls-lrt $HOME/ggserver/dirprm/e*.prmread-p" Please enter the prm file name: "val# enter the table name you need to comment Do not add TABLE and semicolon echo "Please Enter the table you need to annotate" read-n 1vi annotmpecho "--annotate table -" >''$HOME'/gglog/ggcomment/annoLog-'$backuptime'.log'cat annotmp > >'$HOME'/gglog/ggcomment/annoLog-'$backuptime'.log'# backup prm configuration file cp $HOME/ggserver/dirprm/$val $HOME/ggserver/dirprm/bak/$val.$backuptime.bakecho "backup the'$val' to the'$HOME/ggserver/dirprm / bak/$val.$backuptime.bak' ">'$HOME'/gglog/ggcomment/annoLog-'$backuptime'.log'# Select operation type echo checho" Operating table you want to belong to what state? "select ch in" parameter "" noparameter "" REPLICAT "" exit "do# all need to be annotated table with parameter case $ch in" parameter ") sed's / ^ / TABLE / 'annotmp > table1 sed's account / / 'table1 > table2break ;; # all tables need to be annotated without the parameter "noparameter") sed's / ^ / TABLE / 'annotmp > table1 sed's' table1 > table2break;;; "exit") echo "process break" exit 2 politics *) echo "Please select your choice:" 1.parameter "2.noparameter"exit"; esacdone Echo $TALi=1num= `sed-n'$= 'table2` # Annotation Operation while ["$I"-le "$num"] do TAL= `sed-n $iSecretp`table2` # echo $TAL # echo-- $TAL sed "s/$TAL/--$TAL/g" $HOME/ggserver/dirprm/$val > tmp2 cat tmp2 > $HOME/ggserver/dirprm/$val ((iTable2`)); done echo "process complete" > >' $HOME'/gglog/ggcomment/annoLog-'$backuptime'.log'

Tags: Comments data files scripts parameters file names paths input selection configuration semicolons functions backups bulk databases logs types processes synchronization design Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MySQL Linux Huawei Shulou Technology Docker