RE: Shell script to call FTP [off-topic]

From: Vordos, Suzy <Suzy.Vordos_at_qwest.com>
Date: Tue, 5 Apr 2011 13:43:57 -0600
Message-ID: <F9BAF589B638564EBCF9495B0CE1C8980EDC29F642_at_qtdenexmbm24.AD.QINTRA.COM>



If you must use ftp rather than scp -- then look into using the .netrc file (man netrc). The login, passwd and ftp commands can be stored in .netrc as a macro, then executed via shell script. .netrc lives in $HOME of the user executing the script and must be 600.
  • .netrc machine <hostname> login <user> password <passwd> macdef mymacro cd <somedirectory> put $1
  • shell print "$ mymacro myfile "| ftp -v ${FTP_SYSTEM} > ${FTP_LOGFILE} if grep "^250 Transfer complete" ${FTP_LOGFILE} >/dev/null 2>&1 || grep "^226 Transfer complete" ${FTP_LOGFILE} >/dev/null 2>&1 ; then "success" else "fail" fi

From: oracle-l-bounce_at_freelists.org [mailto:oracle-l-bounce_at_freelists.org] On Behalf Of Alex List Sent: Tuesday, April 05, 2011 1:41 PM
To: Oracle I List
Subject: Shell script to call FTP [off-topic]

Hi,

Sorry for posting an off-topic email, but I guess that my simple doubt is really simple to you guys.

In my shell script to transfer files, I am having difficult to do the way I need. Basically when I invoke the shell, it supposed to log in on FTP server with password authenticated and so execute the ftp commands.

############

ftp ftp://backup:bkp123_at_10.1.1.25 << _EOF_ >>/dev/null 2>&1  bin
 prompt
 cd /srv43
 lcd /db/bugtracker/
 mput *.gz
 quit
_EOF_
############

However, when I try to execute I get error like: unknown host

Do you have a suggestion what I am doing wrong?? This same script needs to run on Linux64/bash and AIX.

Thank you in advance for any clue.
Alex



This communication is the property of Qwest and may contain confidential or privileged information. Unauthorized use of this communication is strictly prohibited and may be unlawful. If you have received this communication in error, please immediately notify the sender by reply e-mail and destroy all copies of the communication and any attachments.
--
http://www.freelists.org/webpage/oracle-l
Received on Tue Apr 05 2011 - 14:43:57 CDT

Original text of this message