Site search

Recent Posts

Meta

Categories

Posts

September 2008
M T W T F S S
« Aug   Dec »
1234567
891011121314
15161718192021
22232425262728
2930  

Auto File transfer/copying with SCP

Here is a

Here is a script (below) you can use to copy dump files between machines using scp from an
automated script. Please see attached. The script usage is as
follows:

./auto_scp.sh  
local_file   user@host:remote_folder  
user_password

or

./auto_scp.sh  
user@host:remote_file   local_folder  
user_password

Example:

./auto_scp.sh   dump.dmp   oracle@hostname:/U01/oracle
  <oracle password>

and here is the script
————————————————–

#!/usr/bin/expect -f

# connect via scp
spawn scp “[lindex $argv 0]” “[lindex $argv 1]”
#############################################
expect {
-re “.*es.*o.*” {
exp_send “yes\r”
exp_continue
}
-re “.*sword.*” {
exp_send “[lindex $argv 2]\r”
}
}
interact

Write a comment