Operating System - HP-UX
1836579 Members
1480 Online
110102 Solutions
New Discussion

Re: can't run FTP script in batch mode from HP9000 to HP3000

 
SOLVED
Go to solution
vas  bolpali
Advisor

can't run FTP script in batch mode from HP9000 to HP3000

hello ,
I want to run a script from HP9000(hp-ux 11.0),
which logs on to HP3000(MPE/iX 5.0) with
userid - 'user1.creative' , and password - 'passwd'.
And i want to FTP a file zones.data.creative from HP3000 to HP9000
But my following script is stopping at username - and i
have to enter the password, and ftp commands interactively.
my question is How to make my script to run in bach mode ?

$ ls ftp3k
ftp3k
$
--here is actuval script- ftp3k (on HP9000).
ftp 111.222.44.3
user user1.creative
userpass passwd
get zones.data.creative zones.dat
bye

it is running as following ( i am running this script from hp9000)
$ftp3k
Connected to 111.222.44.3.
220 HP ARPA FTP Server [A0009F07] (C) Hewlett-Packard Co. 1990
Name (136.140.44.3:oracle): -- stops here and looking for username
keeping you ahead of the learning curve
4 REPLIES 4
James R. Ferguson
Acclaimed Contributor
Solution

Re: can't run FTP script in batch mode from HP9000 to HP3000

Hi Vasu:

Do this:

{
echo "open $HOST
user $ACCT $PASS
get yourfile myfile
close"
} | ftp -i -n

Note the '-i' and '-n' options.

Regards!

...JRF...
Volker Borowski
Honored Contributor

Re: can't run FTP script in batch mode from HP9000 to HP3000

Hi Vasu,

the basic fault is, that your script does not provide input to the ftp command.

In addition you should not pass passwords like this. Lookup how to set a .netrc file for your connection. Change your script to

ftp targethosts <cd sourcedir
lcd targetdir
get filename
bye
EOF

The login-information will be taken from .netrc then.

Hope this helps
Volker
Sanjay_6
Honored Contributor

Re: can't run FTP script in batch mode from HP9000 to HP3000

Hi Vasu,

Try this out,

ftp -n 111.222.44.3 <<-EndFTP
user user_name user_password
bin "or" ascii
cd /directory_if_any
get file_name1
get file_name2
.........
bye
EnfFTP

This should work.

thanks
vas  bolpali
Advisor

Re: can't run FTP script in batch mode from HP9000 to HP3000

Hi all,
Great, I solved the FTP issue.
thank you.
Vasu.

keeping you ahead of the learning curve