linux - Check for ftp authentication output for bash script -
i run automated backup shell script, works great, reason ftp blocks me few minutes. add retry , wait feature. below sample of code.
echo "moving external server" cd /root/backup/ /usr/bin/ftp -n -i $ftp_server <<end_script user $ftp_username $ftp_password mput $file bye end_script
after failed login message below
authentication failed. blocked. login failed. incorrect sequence of commands: pass required after user
i need capture such output , make code atempt sleep few minutes before trying again.
ideas?
if it's possible install additional programs onto system of interest encourage take @ lftp
.
with lftp
possible set paramters time between reconnects etc. manually.
to achieve aim lftp
have invoke following
lftp -u user,password ${ftp_server} <<end set ftp:retry-530 "authentication failed" set net:reconnect-interval-base 60 set net:reconnect-interval-multiplier 10 set net:max-retries 10 <some more custom commands> end
if pattern after ftp:retry-530
matches 530 reply of server lftp
tries reconnect every 60*10 seconds.
Comments
Post a Comment