I am trying to transfer a file from one server to a remote server with the help of a TCL script.
But my script stops after the message “200 Port set okay” and continues to rum from the below telnet session.
I have checked the destination location, my file is not transferred.
Please suggest what can I do or where I am wrong
#!/usr/bin/tclsh
#!/usr/bin/expect
package require Expect
set p "mm155_005.006.010.200_bt.fw"
#**************************************************************\
FILE TRANSFER TO REMOTE SERVER \
***************************************************************
spawn ftp 10.87.121.26
expect "User (10.87.121.26:(none)):"
send "user\r"
expect "Password:"
send "pswd\r"
expect "ftp>"
send "cd FW\r"
expect "ftp>"
send "ha\r"
expect "ftp>"
send "bi\r"
expect "ftp>"
send "mput \"$p\"\r"
expect "mput $p? "
send "yes\r"
expect "ftp>"
send "ls\r"
#**************************************************************\
RUNNING THE TRANSFERED FILE \
***************************************************************
spawn telnet 10.87.121.26
expect "Login: "
send "user\r"
expect "password: "
send "pswd\r"
expect "*? > "
send "cd FW\r"
expect "*? > "
send "burnboot 30 5.6(10.200)\r"
Output
spawn ftp 10.87.121.26 Connected to 10.87.121.26. 220 VxWorks FTP server (VxWorks VxWorks5.4.2) ready. Name (10.87.121.26:vkumar): user 331 Password required Password: 230 User logged in Remote system type is UNIX. Using binary mode to transfer files. ftp> cd FW 250 Changed directory to "C:/FW" ftp> ha Hash mark printing on (1024 bytes/hash mark). ftp> bi 200 Type set to I, binary mode ftp> mput "mm155_005.006.010.200_bt.fw" mput mm155_005.006.010.200_bt.fw? yes 200 Port set okay \ I am unable to see hash progress bar after this line spawn telnet 10.87.121.26 Trying 10.87.121.26... Connected to 10.87.121.26. Escape character is '^]'. Login: user password: node84.7.PXM.a > cd FW node84.7.PXM.a > bash-2.05b$
The script as reported is unlikely to produce exactly that output; there is nothing from the
lsdone after themput. However, if themputis hanging the most likely problem is that there is a firewall issue; FTP uses multiple sockets to do file transfers (which is why FTP is such a pain when it comes to overall firewall management). In particular, it has a command channel (the socket which you communicate with the FTP server over) and a separate data channel per file (and also with the output of some remote commands, such asls); that’s what thatPort set okayis about. This is not firewall-friendly, and it’s easy to misconfigure firewalls in this area (especially when there is NAT also in place).You might (i.e., try this first) want to use passive mode instead, as that reduces the complexity at the firewall level. Try issuing a
passivebefore themput(just as you currently issue abinary).