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

    Dear Friend

  I recommend strongly use scp with shared authorized key (ssh
configuration).

It's safe and better!

Any doubt, reply.

Cheers

On Tue, Apr 5, 2011 at 4:43 PM, Vordos, Suzy <Suzy.Vordos@xxxxxxxxx> wrote:

>  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@xxxxxxxxxxxxx [mailto:
> oracle-l-bounce@xxxxxxxxxxxxx] *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@xxxxxxxxx << _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.
>



-- 
______________
Atenciosamente
Waldirio
msn: waldirio@xxxxxxxxx
Skype: waldirio
Site: www.waldirio.com.br
Blog: blog.waldirio.com.br
LinkedIn: http://br.linkedin.com/pub/waldirio-pinheiro/22/b21/646
PGP: www.waldirio.com.br/public.html

Other related posts: