Get the App
SLTechnology News&Howtos  ›  Database  › 

OGG Operation and maintenance Optimization script (12)-Information synchronization Class-Information upload

Shulou Source: shulou.com Published: 2022-06-01 08:50:16 11月14日 Update

File: upload.sh

Path: $HOME/ggscript/ggupload

Function: this script will not be used directly, it is designed to satisfy other scripts for uploading information, and the corresponding file information is directly called within the script.

He reads the system configuration information in the system information configuration file sysinfo

Example

[detest#]

Ip-MTMyLjEyMS4xMDEuODYK

UserName-Z2dzCg==

PassWord-Z2dzxxxxxx

Port-MjIK

Path-L2RhdGExL2dncy9nZ3NlcnZlci9kaXJkZWYK

[# detest]

The above information is encrypted with base64 to ensure the security of the information. Obtain the IP user name, password, and port path.

And send the corresponding files to the corresponding machine.

#! / bin/bashif [$#-eq 0]; then echo "info host file checkf" exit 2fiif [$#-eq 1]; then echo "info host file checkf" exit 2fiif [$#-eq 1] Then echo "info host file checkf" exit 2fihost=$1file=$2checkf=$3cd $HOME/ggscript/ggupload#sed'/ "$host" /, / 5lapp'$checkf > infotmpcat $HOME/ggscript/ggupload/$checkf | awk'/'$host'#/,/#'$host'/ {if (I > 1) print x tersichi 0 Grep +}'> $HOME/ggscript/ggupload/infotmpip= `cat $HOME/ggscript/ggupload/infotmp | grep-w "Ip" | cut-d "-"-f 2`pw = `cat $HOME/ggscript/ggupload/infotmp | grep-w "PassWord" | cut-d "-" f 2`port = `cat $HOME/ggscript/ggupload/infotmp | grep-w "Port" | cut-d "-"-f 2`us = `cat $HOME/ggscript/ggupload/infotmp | grep-w "UserName" | cut-d "-"-f 2`path = `cat $HOME/ggscript/ggupload/infotmp | grep-w "path" | cut-d "-"-f " 2`echo "code" echo "ip=$ip" echo "pw=$pw" echo "port=$port" echo "user= $us" echo "path=$path" echo $ip > tmpperl-MMIME::Base64-ne 'print decode_base64 ($_)'

< tmp >

Outip= `cat out`echo $pw > tmpperl-MMIME::Base64-ne 'print decode_base64 ($_)'

< tmp >

Outpw= `cat out`echo $port > tmpperl-MMIME::Base64-ne 'print decode_base64 ($_)'

< tmp >

Outport= `cat out`echo $us > tmpperl-MMIME::Base64-ne 'print decode_base64 ($_)'

< tmp >

Outus= `cat out`echo $path > tmpperl-MMIME::Base64-ne 'print decode_base64 ($_)'

< tmp >

Outpath= `cat out` # echo "decode" # echo "ip=$ip" # echo "pw=$pw" # echo "port=$port" # echo "user=$us" # echo "path=$path" while [${# port}-le 1] do port=22done#echo $ip $pw $port $pathexpect-c "spawn scp-r-P $port $file $us@$ip:$path expect {\" * assword\ "{set timeout 300; send\" $pw\ r\ ";}\" yes/no\ "{send\" yes\ r\ "; exp_continue;}} expect eof"

Tags: Information files scripts systems paths configurations security functions passwords machines users usernames ports examples and will guarantee encryption design synchronization Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Technology vpn macOS MySQL Xiaomi