linux – FTP:如何摆脱“警告! 1个以ASCII模式接收的裸线馈送“消息?

前端之家收集整理的这篇文章主要介绍了linux – FTP:如何摆脱“警告! 1个以ASCII模式接收的裸线馈送“消息?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我写了一个小 shell脚本(在CentOS上)从我们的APC UPS设备下载统计数据.它工作得很好,但每天cron发送一封包含以下消息的电子邮件
WARNING! 1 bare lineFeeds received in ASCII mode File may not have transferred correctly.

当我在shell上手动获取文件时,我也收到了该消息.我的脚本的FTP部分如下所示:

ftp -in $ftpip <<END_FTP_DOWNLOAD
user $ftpuser $ftppassword
get data.txt
bye
END_FTP_DOWNLOAD

如何摆脱可能会打扰同事的警告信息?

手动FTP连接如下所示.我这次尝试输入“ascii”:

220 AP9617 Network Management Card AOS v2.6.4 FTP server ready.
Name (192.168.0.50:myusername): username
331 User name okay,need password.
Password:
230 User logged in,proceed.
ftp> ascii
200 TYPE Command okay.
ftp> get data.txt
local: data.txt remote: data.txt
227 Entering Passive Mode (192,168,50,161,31).
125 Data connection already open; transfer starting.
WARNING! 1 bare lineFeeds received in ASCII mode
File may not have transferred correctly.
226 Closing data connection.
131468 bytes received in 19,3 secs (6,6 Kbytes/sec)
ftp> bye
221 Thank you for using APC products!

data.txt有500到800行,最后一行总是空的.

解决方法

尝试使用二进制模式而不是ASCII模式.它应该是这样的:
ftp -in $ftpip << END_FTP_DOWNLOAD
user $ftpuser $ftppassword
bin
get $filename
bye
END_FTP_DOWNLOAD
原文链接:https://www.f2er.com/linux/400217.html

猜你在找的Linux相关文章