2016-12-01 95 views
0

我是Linux脚本编写新手。我想将文件从远程服务器复制到当前服务器(正在执行或客户端服务器),必需的证书&密钥文件已安装在我的服务器(客户端服务器)上。下面的命令在我按顺序单独执行时工作,但在集成到.sh脚本后,它不会!通过lftp从远程服务器复制文件

- 我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/';  
+1

你说的“它不”呢?根本没有行动或错误消息(如果是的话)? –

+0

它只执行第一个命令。设置ssl:cert和下面的命令不会被执行。 – Darshan

回答

1

人的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). 
0

使用 “立即文档” 功能:

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

LAV感谢您的建议,我发现我的脚本没有执行第二行,所以增加了延续,如 < < SCRIPT &结束了SCRIPT 脚本删除所有分号......其工作

相关问题