OGG營運最佳化指令碼(十二)-資訊同步類--資訊上傳

來源:互聯網
上載者:User

標籤:og

檔案: upload.sh

路徑:$HOME/ggscript/ggupload

功能:該指令碼不會直接使用,為滿足其他指令碼進行資訊上傳而設計,在指令碼內直接調用上傳相應的檔案資訊

他會讀取系統資訊設定檔sysinfo內的系統配置資訊

範例

[detest#]

Ip-MTMyLjEyMS4xMDEuODYK

UserName-Z2dzCg==

PassWord-Z2dzxxxxxx

Port-MjIK

path-L2RhdGExL2dncy9nZ3NlcnZlci9kaXJkZWYK

[#detest]

以上資訊以base64進行加密,保證資訊安全,擷取IP 使用者名稱,密碼,以及連接埠路徑

並將相應的檔案下發至對應的機器

#!/bin/bashif [ $# -eq 0 ]; then        echo "info host file checkf"        exit 2fi if [ $# -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"/,/5/p‘ $checkf > infotmpcat $HOME/ggscript/ggupload/$checkf | awk ‘/‘$host‘#/,/#‘$host‘/{if(i>1)print x;x=$0;i++}‘ > $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 ]doport=22done#echo $ip $pw $port $pathexpect -c "  spawn scp -r -P $port $file [email protected]$ip:$path  expect {    \"*assword\" {set timeout 300; send \"$pw\r\";}    \"yes/no\" {send \"yes\r\"; exp_continue;}  }expect eof"


本文出自 “netsman” 部落格,請務必保留此出處http://netsman.blog.51cto.com/5750076/1939643

OGG營運最佳化指令碼(十二)-資訊同步類--資訊上傳

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.