Implementation of SCP via expect, incomplete resolution of transfer files

Source: Internet
Author: User

Wrote a script to transfer the file, similar to this:

Sendsystem (){Expect-c "Spawn SCP$ORACLE _base/oradata/$oracle_sid/system01.dbf [email protected]$S _ip:$Oracle_base/oradata/standby/expect{Yes/no{Send\"Yes\ r\"; Exp_continue}*assword*{Send\"Oracle\ r\" }           }; Expect 100%Expect EOF; "}Sendsysaux (){Expect-c "Spawn SCP$ORACLE _base/oradata/$oracle_sid/sysaux01.dbf [email protected]$S _ip:$Oracle_base/oradata/standby/expect{Yes/no{Send\"Yes\ r\"; Exp_continue}*assword*{Send\"Oracle\ r\" }           }; Expect 100%Expect EOF; "}

Results:

Spawn Scp/home/oracle/std_control01.ctl Oracle@192.168.134.134:/oracle/oradata/standby/std_control01. ctloracle@192.168.134.134' s password:std_control01.ctl 100% 9520 KB 9.3mb/s 00:00 Spawn scp/oracle/oradata/orcl/system01.dbf [email protected]:/oracle/oradata/standby/[email prote CTED] 'SPassword:System01.dbf the%646MB33.9MB/sxx: on ETASpawn scp/oracle/oradata/orcl/sysaux01.dbf Oracle@192.168.134.134:/oracle/oradata/standby/Oracle@192.168.134.134' s password:sysaux01.dbf 100% 600 MB 31.6mb/s 00:19 Spawn scp/oracle/oradata/orcl/temp01.dbf [email Protected]:/oracle/oradata/standby/[email Protect Ed] 'SPassword:Temp01.dbf -% $MB66.7MB/sxx:GenevaSpawn scp/oracle/oradata/orcl/undotbs01.dbf Oracle@192.168.134.134:/oracle/oradata/standby/Oracle@192.168.134.134' s password:undotbs01.dbf 100% 200 MB 40.0mb/s 00:05

SYSTEM01.DBF didn't pass it.
I've tried it a couple of times, and sometimes the other files don't pass through.

Last found because the expect default timeout is 30S
Manually add set Timeout-1 setting time-out is infinity, problem solved

sendsystem () { expect-c "set Timeout-1 Spawn SCP  $ORACLE _base/oradata/$  oracle_sid/system01.dbf [email  ;p rotected] $S _ip:$  oracle_base/oradata/standby/expect { yes/no { send \"  yes\r  \ "; Exp_continue   *assword* { send \ " oracle\r  \"            Span class= "Hljs-special" ">}  } ;       Expect 100%  expect EOF; "}   

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Implementation of SCP via expect, incomplete resolution of transfer files

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.