我正在尝试从kermit转换到lftp。旧脚本从另一个脚本获取命令,用于文件的往返位置。我仍然想要这个输入文件,但是我在让它从输入文件中读取命令时遇到了麻烦。
旧的utils脚本使用kermit:
/appl/bin/kermit $M_SCRIPT_TMP_FILE | sed -e '/^$/d' -e 's/^/ /' >> ${LOGFILE:-/home/mcleary/k_test/michele/logs/default.log} 2>&1
kermit version $M_SCRIPT_TMP_FILE包含每个脚本执行ftp (lcd行向下)的内容:
ftp open MMMMSITE /USER:useruser /PASSWORD:pwpw
LOG TRANSACTIONS /app/tmp/m_Ftp_trans.tmp
lcd /home/mcleary/k_test/michele/
cd trans/
ascii
put test3.txt
exit
使用输入文件的lftp脚本如下所示:
/usr/bin/lftp -f $M_SCRIPT_TMP_FILE | sed -e '/^$/d' -e 's/^/ /' >> ${LOGFILE:-/home/mcleary/k_test/michele/logs/default.log} 2>&1
对于lftp版本,输入文件看起来像这样:
open ftp://useruser:pwpw://MMMMSITE
LOG TRANSACTIONS /app/tmp/m_Ftp_trans.tmp
lcd /home/mcleary/k_test/michele/
pwd
cd trans/
ls
put test4.txt
bye
lftp的输出/错误信息是:
open: ftp: Name or service not known
cd: Not connected
ls: Not connected
put: Not connected
Exit Status - m_Ftp2: 0
m_cmd from ckcmd: m_exit
m_log_only from ckcmd:
知道为什么lftp不能识别ftp输入行吗?
更新:我知道lftp像这样从命令行工作,但我需要输入文件:
lftp -u useruser,pwpw ftp://MMMMCO <<EOF
> lcd /home/mcleary/k_test/michele/
> cd transfer
> put test.txt
> bye
> EOF
UPDATE2:我尝试了新的utils脚本使用lftp,像这样:
open -u useruser,pwpw ftp://MMMMSITE
这是输出消息:
cd: Login failed: 530 User cannot log in.
ls: Login failed: 530 User cannot log in.
put: Login failed: 530 User cannot log in.
Exit Status - m_Ftp2: 0
m_cmd from ckcmd: m_exit
m_log_only from ckcmd:
我修好了。
filename.txt:
open ftp://MMMMSITE -u useruser,'pwpw'
lcd /home/mcleary/k_test/michele/
pwd
cd trans/
ls
put test5.txt
bye
然后使用该文件:
lftp -f filename.txt