Darshan
Darshan

Reputation: 1

Copy file from remote server through lftp

I'm new to linux scripting. I want to copy file from remote server to current server(executing or client server),required cert & key files are already installed on my server(client server). below commands work when I execute it individually in sequence but, after Integrating into a .sh script it doesnt!

--My Script--

    lftp -u username,xxx -p 2121 remoteServer.net; 
    set ssl:cert-file /abc/def/etc/User_T.p12;    
    set ssl:key-file abc/def/etc/User_T.p12.pwd;    
    lftp -e 'set net:timeout 10; get /app/home/atm/feed.txt -o /com/data/';    

Upvotes: 0

Views: 2383

Answers (3)

Darshan
Darshan

Reputation: 1

Thanks lav for your suggestion, I found that my script was not executing second line so added continuation like << SCRIPT & ended script with SCRIPT removed all semi colon... Its working

Upvotes: 0

lav
lav

Reputation: 1481

Use "here document" feature of the shell:

lftp <<EOF
set... 
open... 
get...
EOF

Upvotes: 0

Ipor Sircer
Ipor Sircer

Reputation: 3141

man lftp:

   -f script_file
          Execute commands in the file and exit.  This option must be used
          alone without other arguments (except --norc).

   -c commands
          Execute  the  given commands and exit. Commands can be separated
          with a semicolon, `&&' or `||'. Remember to quote  the  commands
          argument  properly in the shell.  This option must be used alone
          without other arguments (except --norc).

Upvotes: 1

Related Questions