1751749 Members
5406 Online
108781 Solutions
New Discussion юеВ

FTP Auto login

 
SOLVED
Go to solution
vinay_26
Advisor

FTP Auto login

I need to FTP file to a server through scripts. The files should get transferred automatically where there will be no user interuption. Can anybody suggest me a script.

I made an entry in .netrc file and wrote script. But it halts after the first FTP command. Pls suggest. OS is HPUX 11.0.
4 REPLIES 4
RAC_1
Honored Contributor
Solution

Re: FTP Auto login

If you write a script be sure to put appropriate perms on it. The script wuold like follows.

-------------
FTP Script
--------------
ftp -in myhost << EOF
user username password
get /tmp/bla
get /tmp/foo
EOF

------------------------------------------------------------
#ftp at command line(exposes the user password)
-------------------------------------------------------------
(
echo "echo "user user_name user_pass"
echo "bin"
echo "cd /to_dir"
echo "put your_file"
echo "close"
echo "bye"
)|ftp -vni hostname > log_file

The better is to use .netrc file.

Anil
There is no substitute to HARDWORK
Rick Garland
Honored Contributor

Re: FTP Auto login

An option to automate ftp file transfers without using the $HOME/.netrc file...

ftp -n -v hostname > $LOG << ENDFTP
user username passwd
prompt off
binary
cd wherever
lcd wherever
mget *
quit
Cem Tugrul
Esteemed Contributor
Bejoy C Alias
Respected Contributor

Re: FTP Auto login

Create a file with the contents

user


Run ftp as 'ftp -in < filename'
Be Always Joy ......