Help with a bash ftp script

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • alpnz
    New Member
    • Nov 2006
    • 113

    Help with a bash ftp script

    I keep getting an error on the windows login of the following script. Any ideas anyone?

    Code:
    #!/bin/sh
    #A script to move files across a network, which has strict firewalling, and only one gateway computer.
    #No issues with PASV other than it does not function well through the firewall.
    
    #Define the server to get the files from, and the files I want (It is a Windows ftp server, that I can connect too.)
    
    HOST="192.168.195.195"
    USER="user1"
    PASS="alibaba1"
    FILE11=clientraw.txt
    FILE22=clientrawdaily.txt
    FILE33=clientrawextra.txt
    
    
    #Define the server I want to put the files into.
    
    HOST1="ftp.somewhere.on.the.net"
    USER1="user2"
    PASSWD1="alibaba2"
    FILE1=/scripts/wxdata/clientraw.txt
    FILE2=/scripts/wxdata/clientrawdaily.txt
    FILE3=/scripts/wxdata/clientrawextra.txt
    
    #Go get the files from the windows box too the Linux gateway server. (Stalls at the password stage on the windows server.)
    
    ftp -n $HOST PASV<<END_SCRIPT
    quote USER $USER
    quote PASS $PASS
    get $FILE11	/scripts/wxdata/clientraw.txt
    get $FILE22	/scripts/wxdata/clientrawdaily.txt
    get $FILE33	/scripts/wxdata/clientrawextra.txt
    quit
    END_SCRIPT
    
    #Put the files where I want. (This part works fine)
    
    ftp -n $HOST1 <<END_SCRIPT
    quote USER $USER1
    quote PASS $PASSWD1
    put $FILE1 /htdocs/wx/clientraw.txt
    put $FILE2 /htdocs/wx/clientrawdaily.txt
    put $FILE3 /htdocs/wx/clientrawextra.txt
    quit
    END_SCRIPT
    exit 0
    Any help appreciated.
Working...