ftp上传文件到服务器
/home/androidhotfix/hotfix-soft/inetutils/bin/ftp -p -niv <<- EOF
open 101.71.xxx.xxx
user dxy XXXXXXXXX
binary
cd /aspirin/hotfix/$patchTypeNamePath
put $patchFileName $patchFileName
put $patchInfoName $patchInfoName
bye
EOF
如果配置了path,/home/androidhotfix/hotfix-soft/inetutils/bin/ftp 可以直接改成ftp
-p参数可以去掉,那么使用默认ftp工作方式
shell脚本上传文件到ftp及I won't open a connection to xxx -- only to xxx错误
自动连接上传文件到ftp服务器脚本异常
Connected to 101.71.xxx.xxx.
220---------- Welcome to Pure-FTPd [privsep] [TLS] ----------
220-You are user number 1 of 50 allowed.
220-Local time is now 14:36. Server port: 21.
220-This is a private system - No anonymous login
220-IPv6 connections are also welcome on this server.
220 You will be disconnected after 15 minutes of inactivity.
Remote system type is UNIX.
Using binary mode to transfer files.
331 User aspirin OK. Password required
230 OK. Current restricted directory is /
200 TYPE is now 8-bit binary
250 OK. Current directory is /aspirin/hotfix/release
500 I won't open a connection to 192.168.xxx.xxx (only to 101.68.xxx.xxx)
/home/androidhotfix/hotfix-soft/inetutils/bin/ftp: bind: Address already in use
500 I won't open a connection to 192.168.xxx.xxx (only to 101.68.xxx.xxx)
221-Goodbye. You uploaded 0 and downloaded 0 kbytes.
221 Logout.
解决方案
由ftp主动模式切换到被动模式
由
...
ftp -p -niv <<- EOF
...
改成
...
ftp -niv <<- EOF
...
参考Getting “I won't open a connection to” when connecting to FTP server from Google Compute Engine