Error with LFTP


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Error with LFTP
# 1  
Old 05-20-2018
Error with LFTP

I use below ftp command to push the file from UNIX server to Mainframe system.

Code:
(lftp -d -e "set ftp:passive-mode false; put -a ${SPOOLFILE} -o ${FNAME}; exit" -u ${id},${paswd} ${host} ) >> $ftplog

To ftp the file successfully i need to get the out put for FNAME as
Code:
 "'filename'"

(double quote followed by single quote filename then single quote followed by double quote).

I tried assigning below format for FNAME but i could get the format as required.

Code:
 

FNAME="\"'filename'"\"

o/p FNAME="'\''filename'\''"


FNAME=\"'filename'\"

o/p FNAME="'\''filename'\''"


FNAME="\"'filename'\""

o/p FNAME= "filename"


FNAME="\""'"filename"'"\""

o/p FNAME= "'\''filename'\''"

Can anyone help me to get the required quote in put command.
# 2  
Old 05-20-2018
Hmmm - where exactly is the problem?
Code:
FNAME="\"'filename'"\"
echo "${FNAME}"
"'filename'"

Isn't this what you need?
# 3  
Old 05-20-2018
I have problem when executing the lftp command. we get correct format when echo in variable but when executing through lftp FNAME not having same formatting. i tried four different formatting condition in FNAME variable but no luck. Results are given in o/p.
# 4  
Old 05-20-2018
What "problem when executing the lftp command"? Show the error and messages verbatim, char by char. You may want to set the -xtrace option when executing the script to get a better feeling what is actually happening.
How are the "Results ... given in o/p." obtained?
# 5  
Old 05-20-2018
Script which i use

Code:
FNAME="\"'FDSD109.PRD.SARS.WRKS.GBLCDS'"\"
echo $FNAME
ftplog=$WHOME/output/ftp_${FILE_NAME}${FILE_SUFFIX}
(lftp -d -e "set ftp:passive-mode false; put -a ${SPOOLFILE} -o ${FNAME}; exit" -u ${id},${paswd} ${host} ) >> $ftplog

Output when executing

Code:
+ FNAME='"'\''FDSD109.PRD.SARS.WRKS.GBLCDS'\''"'
+ echo '"'\''FDSD109.PRD.SARS.WRKS.GBLCDS'\''"'
"'FDSD109.PRD.SARS.WRKS.GBLCDS'"
+ ftplog=/output/ftp_FDSD109.PRD.SARS.WRKS.GBLCDS.200518071144
+ >>output/ftp_FDSD109.PRD.SARS.WRKS.GBLCDS.200518071144

+ lftp -d -e 'set ftp:passive-mode false; put -a Extract/EIS/files/FDSD109.PRD.SARS.WRKS.GBLCDS.200518071144 -o "'\''FDSD109.PRD.SARS.WRKS.GBLCDS'\''"; exit' -u xxxx,yyyy zzz.zzz.com
---- Connecting to zzz.zzz.com  port 21
<--- 220-NTFTP1 IBM FTP CS V2R1 at zzz.zzz.COM, 11:11:45 on 2018-05-20.
<--- 220 Connection will close if idle for more than 10 minutes.
---> FEAT
<--- 211- Extensions supported
<---  AUTH TLS
<---  PBSZ
<---  PROT
<--- 211 End
---> AUTH TLS
<--- 234 Security environment established - ready for negotiation
---> USER xxxx
<--- 331 Send password please.
---> PASS yyyy
<--- 230 xxxx is logged on.  Working directory is "xxxx.".
---> PWD
<--- 257 "'xxxx.'" is working directory.
---> PBSZ 0
<--- 200 Protection buffer size accepted
---> PROT C
<--- 536 Data connection protection clear not supported
---> PORT 19,111,6,226,133,20
<--- 200 Port request OK.
---> ALLO 2042285
<--- 202 ALLO not necessary, you may proceed
---> STOR 'FDSD109.PRD.SARS.WRKS.GBLCDS'
<--- 425-Server requires protected data connection.
<--- 425 Can't open data connection.
---- Closing data socket
---> PORT 19,111,6,226,227,163
<--- 200 Port request OK.
---> STOR 'FDSD109.PRD.SARS.WRKS.GBLCDS'
<--- 425-Server requires protected data connection.
<--- 425 Can't open data connection.




Moderator's Comments:
Mod Comment It's NOT a good idea to post login data. I concealed it for you...

Last edited by RudiC; 05-20-2018 at 10:13 AM.. Reason: obfuscated possibly sensitive data
# 6  
Old 05-20-2018
Did you try without ANY quoting of the file name?
Are you sure the failure is caused by the file name, NOT by e.g. a firewall or a protection setting that blocks the "data connection" due to "protection clear"?
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Lftp command

Hello, I am trying to write a script that will lftp a file. The parameters are being passed in to the script from ETL tool. The put command is not working. put $file_name $tgt_file_name in the function ftpfile(). When I hardcode the file name with path its working. can some one help me... (5 Replies)
Discussion started by: skatpally
5 Replies

2. Shell Programming and Scripting

lftp is not working.how to replace lftp with expect utility using same .cfg file.

We have lftp command inside shell file. which is intern calling .cfg file for transferring the file from one server to other. Below command to not working. lftp -e "set net:max-retries 1; set net:reconnect-interval-base 1; put -E -O /destinationdir/inbox/ /sourcedir/test.txt; bye" -u... (4 Replies)
Discussion started by: johnsnow
4 Replies

3. UNIX for Dummies Questions & Answers

Lftp operation

dear all, I need to get files from ftp when only files consist of words 'EUROPE' ftp sources in folder /ftp1/ftp2/ftp3/201409 files inside /ftp1/ftp2/ftp3/201409is as below 201409_EUROPE_citizen.txt 201409_EUROPE_natality.txt 201409_EUROPE_occupancy.txt 201409_ASIA_citizen.txt... (1 Reply)
Discussion started by: radius
1 Replies

4. Red Hat

Lftp issue

I installed KVM and configured two virtual machines in it server1.example.com(192.168.100.193) and tester1.example.com(192.168.100.230).I want to access server1.example.com from tester1.example.com over lftp.As far as networking is concerned between both I do have some doubts. I tried ping and... (5 Replies)
Discussion started by: shazgaurav
5 Replies

5. Shell Programming and Scripting

Lftp with dialog

Hi all. I want to know, if there is any chance to pass lftp listing to CLI dialog. I want to make an interactive CLI ftp manager, based on lftp. Version of dialog I use: root@dlink:~# dialog -v cdialog (ComeOn Dialog!) version 1.1-20100428 (0 Replies)
Discussion started by: n158
0 Replies

6. UNIX for Advanced & Expert Users

lftp: Option to lftp a file, wait and download a file as soon as its created

Please let me know what is lftp options combination to wait and download a file from target as soon as its gets created. I tried with different options but not able to get it working as I need any help would be appreciated (4 Replies)
Discussion started by: bmkux
4 Replies

7. UNIX for Advanced & Expert Users

LFTP Mirroring

LFTP Mirroring We are planning to use lftp to mirror some of the files and directories on to the remote server. What we exactly want to do is mirror some of the directories and exclude some of the the directories from "/" i.e. main root. . What lftp is doing is... (0 Replies)
Discussion started by: sameerarora
0 Replies

8. UNIX for Dummies Questions & Answers

lftp transmission error help

We have installed lftp version 3.4.7. When trying to send a file it loops on sending. It appears that the lftp sends about 130k then attempts to verify transmission (with a head command maybe). The receiver is pulling the data immediatly behind the firewall and does not appear to be answering... (0 Replies)
Discussion started by: Iversog
0 Replies
Login or Register to Ask a Question