send files through ftp using proxy in a loop


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting send files through ftp using proxy in a loop
# 1  
Old 03-07-2012
send files through ftp using proxy in a loop

Hi,

I have a problem with sending files to ftp using proxy.
When using this script:
Code:
#!/bin/bash
DIR=/dane_wz
ftp -n -v 172.30.100.13 << EOF
quote USER xxx@172.25.240.45
quote PASS xxxx
passive
cd $DIR
quit
EOF

it works fine and I get connection with FTP server, but using the same in a loop:
Code:
#!/bin/bash
DIR=/home/mf/mfinpazp
while RES=$(inotifywait -e create $DIR); do
    FILE=${RES#?*CREATE }
    if [ ${FILE: -3} == ".wz" -o  ${FILE: -4} == ".md5" ] ; then
         ftp -n -v 172.30.100.13 << EOF
         quote USER xxx@172.25.240.45
         quote PASS xxxx
         passive
         cd /dane_wz
         quit
EOF
     fi
done

keeps giving me this error:
Code:
220 Welcome to MFW Gateway
530 proxy: login incorrect
502 proxy: command not implemented

Any idea how to solve it?

Łukasz
# 2  
Old 03-07-2012
You can't indent lines in a here-document unless you use <<-
e.g:
Code:
         ftp -n -v 172.30.100.13 <<-EOF

# 3  
Old 03-07-2012
thanks for reply,

but neither putting - (minus) nor removing all indents works here, I have made it look easier:

Code:
#!/bin/bash
DIR=/home/mf/mfinpazp
while RES=$(inotifywait -e create $DIR); do
ftp -n -v 172.30.100.13 << EOF
quote USER xxxxxxxx
quote PASS xxxxx
quit
EOF
done

and still same error "login incorrect"

Łukasz

Last edited by vrolok; 04-23-2012 at 11:58 AM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Proxy Server

Ftp using proxy RHEL 6.2

Hello all I am connecting vendors ftp site to get the data using our proxy server. 1. First I connect to my company's Proxy Server using ftp. ftp myorg.proxy.server After this command I am connecting to proxy. This does not ask me password. 2. Now from Proxy I run another Ftp command.... (0 Replies)
Discussion started by: krsnadasa
0 Replies

2. Shell Programming and Scripting

FTP to send files using Binary mode

I am using below code to send files into ascii mode.what changes will I have to do to send files into Binary mode ? ftp -in <<FIN open $SAP_UP_SERVER user $SAP_UP_USER $SAP_UP_PASSWORD asc put $PM00_OUTPUTS_DIRECTORY/$SAP_UP_FILE_CSV /SAP_UP_FILE_CSV quit FIN (1 Reply)
Discussion started by: Nitin Varshneya
1 Replies

3. Shell Programming and Scripting

Shell FTP script to send all files to different path

Hello to all in forum I hope you can help me. I want to send via FTP to a linux server the 2 kind of files that are in the same folder, as follow: 1- Send all files that are named verified.SomeString.zz.pttp to path /var/verified 2- Send all files where the name begins with verified.conf... (3 Replies)
Discussion started by: Ophiuchus
3 Replies

4. Red Hat

Ftp problem on proxy server

Hi all, First of all i would like to say sorry to all for my english. My name is Mastan. We have an proxy server have 2 lan cards. one is for public and another for private. public ip: 182.72.141.... private ip: 192.168.0.0 So, the thing is i configure ftp server in my local for... (0 Replies)
Discussion started by: mastansaheb
0 Replies

5. Shell Programming and Scripting

Need code to ftp files in loop

I have files like this beginning from 082008 (MMYYYY) to 112010 (MMYYYY) I need to fetch this files through ftp in loop. How can I achieve it? I tried with the following code. But I'm not sure how to increment the month from 082008 to 112010. for i in {082008 .. 112010} ... (5 Replies)
Discussion started by: Gangadhar Reddy
5 Replies

6. UNIX for Advanced & Expert Users

Trouble connecting to FTP proxy server

Hi Guys, I have trouble connecting to ftp server. My task is to connect to the proxy server and get the latest file to the local machine. It works fine when i do the same steps manually. I've been trying to do it in multiple ways but im just not able to connect. When i check the log, this is what... (4 Replies)
Discussion started by: stunnerz_84
4 Replies

7. UNIX for Advanced & Expert Users

Unix FTP Script connecting through proxy Not working

Hi All, can some one please help me to solve this issue, its urgent:confused: We need to FTP a file form our Unix server to an external client FTP location. I am trying to connect to the proxy server first and then use the below USER comment to connect to the external FTP server, and its working... (3 Replies)
Discussion started by: JesusJoseph
3 Replies

8. IP Networking

Software/tool to route an IP packet to proxy server and capture the Proxy reply as an

Hi, I am involved in a project on Debian. One of my requirement is to route an IP packet in my application to a proxy server and receive the reply from the proxy server as an IP packet. My application handles data at the IP frame level. My application creates an IP packet(with all the necessary... (0 Replies)
Discussion started by: Rajesh_BK
0 Replies

9. Solaris

Ftp Proxy Solaris 8

Hi All, I need help using the native Solaris 8 ftp client. I need to ftp through a ftp proxy. How would this be confiured on Solaris 8? Any help would be greatly appreciated. (0 Replies)
Discussion started by: cstovall
0 Replies

10. Shell Programming and Scripting

Need to send multiple files during ftp

Hi guys... I'm working on #!/bin/sh script in a Solaris 7 box that should send several files over to another machine via FTP. Here's what the script looks like: # This script will send the daily MSP customer counts # to the Crystal Reports server located at 192.168.2.106 cd... (2 Replies)
Discussion started by: cdunavent
2 Replies
Login or Register to Ask a Question