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
Posted: September 19th, 2008 under Uncategorized.