任何人都有一个想法会是什么问题?无法登录到FTP服务器
#!/bin/bash -x
HOST='192.163.3.3'
USER='ftpuser'
PASSWD='apple'
Logfile=a.log
while :; do
ftp -n -p -v $HOST <example.script>> a.log
grep -qF "Connected" a.log &&
grep -qF "File successfully transferred" a.log && break
done
quote USER $USER
quote PASS $PASSWD
example.script包含
put example.txt
运行它给
grep: a.log: No such file or directory
grep: a.log: No such file or directory
.
.
example.script和创建a.log是在/ home目录
的一个后。日志包含
Connected to 192.163.3.3.
220---------- Welcome to Pure-FTPd [privsep] [TLS] ----------
220-You are user number 9 of 50 allowed.
220-Local time is now 14:38. 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.
local: example.txt remote: example.txt
530 You aren't logged in
Passive mode refused.
221-Goodbye. You uploaded 0 and downloaded 0 kbytes.
221 Logout.
为什么不能登录?
HOST='192.163.3.3'
USER='ftpuser'
PASSWD='apple'
FILE='example.txt'
Logfile=a.log
ftp -n -p -v $HOST <<SCRIPT_END>> a.log
quote USER $USER
quote PASS $PASSWD
put $FILE
SCRIPT_END
有了这个工作,但为什么?会有什么区别?
另一个脚本的作品,但只运行一次,用这个脚本将是问题 – Smithis
你可以写一个单行描述如何做到这一点? –