Bash Script to transfer file between servers
This is expect script to send files between 2 different servers
#!/bin/expect -f
#taking aurgument 1 as file name
set name [lindex $argv 0]
#logging in into remote server
spawn sftp applmgr@172.*.*.*
expect "applmgr@172.*.*.*'s password:"
send "password\r"
expect "sftp>"
#transferring file using put command from and to path
send "put -p /u02/oracle/VIS/${name} /u02/oracle/VIS/fs1/EBSapps\r"
expect "sftp>"
#refresh
send "lcd /u02/oracle/VIS"
expect "sftp>"
#refresh
send "cd /u02/oracle/VIS/fs1/EBSapps\r"
expect "sftp>"
#exiting remote server
send "exit\r"
helpful
ReplyDelete