Operating System - HP-UX
1854677 Members
10158 Online
104102 Solutions
New Discussion

I need a UX-Windows ftp script...

 
SOLVED
Go to solution
Eric Antunes
Honored Contributor

I need a UX-Windows ftp script...

...to get a Windows file (from a Windows server) to my HP-UX box. I need to do this everyday so I'll cron it latter: my problem is how to create this script... Can anyone help me?

Thanks,

Eric Antunes
Each and every day is a good day to learn.
28 REPLIES 28
Naveej.K.A
Honored Contributor

Re: I need a UX-Windows ftp script...

Hi Eric,

Your answer is there in this thread:

http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=544909

Regards,
--Naveej
practice makes a man perfect!!!
renarios
Trusted Contributor

Re: I need a UX-Windows ftp script...

Hi Eric,

Assuming there's an ftp deamon on windows, here's a same-like thread:
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=811436

Cheers,

Renarios
Nothing is more successfull as failure
harry d brown jr
Honored Contributor

Re: I need a UX-Windows ftp script...

If you can use R'commands, then on your windoze box use rcp:

rcp -b C:\FILEPATH\FILENAME UXhostNAME.USERNAME:/path

Put it in a windoze script and then add it to the windoze scheduler.

live free or die
harry d brown jr
Live Free or Die
Cem Tugrul
Esteemed Contributor

Re: I need a UX-Windows ftp script...

Hi Eric,

i have still an active process as yours
and upto now i have never seen any error...
Before this i have asked this in this forums
but it was urgent then i searched in internet
and found a software which was installed my
W2k server named Winsock RSHD/NT4 from
Denicomp...
For a single server it is not expensive and
also it very easy to install...this software
accepts rcp commands from any Ux systems in your network.
One of my production Ux server i have written
a very primitive script and put it onto my cron.
For exp;
Let's say that you wanna put some *.txt files
from UX --->W2k
then script likes;
cd source_dir
test -f *.txt && rcp -p *.txt ip_adress_W2k:/blah

from W2k--->UX
again script locates on my Ux box;
cd source_dir
rcp -p ip_adress_W2k:/blah* .

that's all...

Good luck,





Our greatest duty in this life is to help others. And please, if you can't
TwoProc
Honored Contributor

Re: I need a UX-Windows ftp script...

Even better - download the Cygwin toolset, and use the ftp or sftp applications with the bash shell that you can run. Cygwin is FREE from www.cygwin.com. It provides a UNIX shell, xwindows, a couple of x-desktops, gcc, awk, sed, wc, etc (all the good UNIX command line tools and development sets you need). Believe me, once you get an xterm with a nice bash shell on your Windoze box - you'll feel right at home and you won't have to bother with DOS. It also comes with a cron application, but I've not set it up to run yet.
We are the people our parents warned us about --Jimmy Buffett
Fred Ruffet
Honored Contributor

Re: I need a UX-Windows ftp script...

What about free things, you already have ?

On your windows server, activate ftp service. cron a script on the unix box to get the file. In order to use ftp in a shell, lokk at the -n option. It will log without asking for user/pass. You'll have to supply them with user and pass commands.

for example :
ftp -n myWinServer << EOF
USER bob
PASS hisPass
cd thecorrectdir
get theFile
quit
EOF


Regards,

Fred
--

"Reality is just a point of view." (P. K. D.)
Geoff Wild
Honored Contributor

Re: I need a UX-Windows ftp script...

Well... the simple way, embed the password in your script:

Yourfile=c:\somedir\file

ftp -nv w2kserver<>$LogFile
user ntuser ntuserpassword
bin
get $Yourfile
quit
EndFTP

A litle more secure - use a .netrc file - place in the home dir of the user that executes the script with permission 400

machine w2kserver login ntuser password ntuserpassword

Then the script:
Yourfile=c:\somedir\file

ftp -nv w2kserver<>$LogFile
bin
get $Yourfile
quit
EndFTP

You could also look at CIFS to accomplish this as well...

Rgds...Geoff

Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
Eric Antunes
Honored Contributor

Re: I need a UX-Windows ftp script...

Hi all,

Thanks for the replies.

I'm analysing all the options given until now. After this I will assign points for all answers.

Harry,

What are "R'commands"? Remote commands??

Thanks,

Eric Antunes
Each and every day is a good day to learn.
Fred Ruffet
Honored Contributor

Re: I need a UX-Windows ftp script...

Rcommands are rlogin, rsh and rcp.
They are available on windows with the appropriate software.

Regards,

Fred
--

"Reality is just a point of view." (P. K. D.)
Eric Antunes
Honored Contributor

Re: I need a UX-Windows ftp script...

Hi all,

Using this script:

myfile=d:\dados\fab_ora\planeado.txt
ftp -nv windoze_server << EOT
user administrator pass
get $myfile
quit
EOT

I get:

"
...
d:dadosfab_oraplaneado.txt: The system cannot find the file specified."

Any clue??


Thanks,

Eric Antunes
Each and every day is a good day to learn.
Fred Ruffet
Honored Contributor

Re: I need a UX-Windows ftp script...

It is a ftp server. Not a *good* ftp server :)

You must cd, before get. Get with absolute path won't work

Regards,

Fred
--

"Reality is just a point of view." (P. K. D.)
Eric Antunes
Honored Contributor

Re: I need a UX-Windows ftp script...

Hi Fred,

It is a windoze ftp server: I cannot expect much more... :)

Regards,

Eric
Each and every day is a good day to learn.
Eric Antunes
Honored Contributor

Re: I need a UX-Windows ftp script...

Hi,

How can I change to d:?

Thanks,

Eric
Each and every day is a good day to learn.
Geoff Wild
Honored Contributor

Re: I need a UX-Windows ftp script...

Try quoting it:

myfile="d:\dados\fab_ora\planeado.txt"
ftp -nv windoze_server << EOT
user administrator pass
get $myfile
quit
EOT


Rgds...Geoff
Proverbs 3:5,6 Trust in the Lord with all your heart and lean not on your own understanding; in all your ways acknowledge him, and he will make all your paths straight.
harry d brown jr
Honored Contributor
Solution

Re: I need a UX-Windows ftp script...

On your windoze box, create a batch file:

cd c:\hbrown\downloads
rcp -b boinc-hpux_32+64.tar.gz vpart1.root:/var

on your UX box, allow the user "root" from your windoze box to use .rhosts.

then on your windoze box (For XP:)

control panel->Scheduled tasks->add scheduled task
follow the "other" thirty instructions and then set the time to execute.

I did a one timer, and it worked great.

live free or die
harry d brown jr
Live Free or Die
Eric Antunes
Honored Contributor

Re: I need a UX-Windows ftp script...

Harry,

I get:

"remshd: login incorrect" on the windoze server...

What do I need to put in .rhosts? I puted the following in .rhosts:

...

...

Is it wrong??

Thanks,

Eric

Each and every day is a good day to learn.
Eric Antunes
Honored Contributor

Re: I need a UX-Windows ftp script...

Geoff,

Quoting doesn't work either... I'm asking the windoze administrator to give me a ftp user with an approriate home (d:...)

Thanks,

Eric
Each and every day is a good day to learn.
Naveej.K.A
Honored Contributor

Re: I need a UX-Windows ftp script...

Eric,

The .rhosts file on the UX server should read like this.


Even though you are passing the root login to unix host, the local user (windows login) must be trusted by unix. You should try the windows loginname.


Thaya had the same problem. Check this thread:

http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=877339

Regards,
--Naveej
practice makes a man perfect!!!
Eric Antunes
Honored Contributor

Re: I need a UX-Windows ftp script...

Naveej,

That's exactly this I have in .rhosts but no results...

Anyway, I'm going trought FTP since I got the right ftp home (d:\dados\fab_ora).

PS: I'll close this thread in the afternoon if no one have nothing more to say about the .rhosts issue!

Thanks to all,

Eric Antunes
Each and every day is a good day to learn.
harry d brown jr
Honored Contributor

Re: I need a UX-Windows ftp script...

Eric,

In the home directory of hbrown (/home/hbrown) on my server vpart1, I created a .rhosts file with this entry:

rnd-hb.MYDOMAIN.com hbrown

I then modified the original script (M$ batch file) on my XP pc, to use the user name of hbrown:

cd c:\hbrown\downloads
rcp -b boinc-hpux_32+64.tar.gz vpart1.hbrown:/home/hbrown

The syntax of M$'s rcp is

rcp -b [hostname][.username]:[path] [hostname][.username]:[path]


-b for binary transmit (otherwise M$ will F with your data)
I then did the scheduling thing with the task manager (for testing purposes I run it once - by changing the date and time) and it worked great:

[root@vpart1 /home/hbrown]# ll
total 288
-r--r--r-- 1 hbrown users 832 Nov 14 2000 .cshrc
-r--r--r-- 1 hbrown users 347 Nov 14 2000 .exrc
-rw-rw-rw- 1 root sys 24 Jun 21 2004 .forward
-r--r--r-- 1 hbrown users 334 Nov 14 2000 .login
-rw------- 1 hbrown users 32572 Jun 8 2004 .lsof_vpart1
-r--r--r-- 1 hbrown users 470 May 25 07:11 .profile
-rw-rw-rw- 1 root sys 26 May 27 06:47 .rhosts
-rw-rw-rw- 1 root sys 20480 Jan 24 14:26 a.out
-rw-rw-rw- 1 root sys 11125 Oct 21 2004 sha256.c
-rw-rw-rw- 1 root sys 443 Oct 21 2004 sha256.h
-rw------- 1 root sys 4 Oct 21 2004 tryme
-rw-rw-rw- 1 root sys 4 Oct 21 2004 tryme2
[root@vpart1 /home/hbrown]#

After the rcp:

[root@vpart1 /home/hbrown]# ll
total 992
-r--r--r-- 1 hbrown users 832 Nov 14 2000 .cshrc
-r--r--r-- 1 hbrown users 347 Nov 14 2000 .exrc
-rw-rw-rw- 1 root sys 24 Jun 21 2004 .forward
-r--r--r-- 1 hbrown users 334 Nov 14 2000 .login
-rw------- 1 hbrown users 32572 Jun 8 2004 .lsof_vpart1
-r--r--r-- 1 hbrown users 470 May 25 07:11 .profile
-rw-rw-rw- 1 root sys 26 May 27 06:47 .rhosts
-rw-rw-rw- 1 root sys 20480 Jan 24 14:26 a.out
-rw-rw-rw- 1 hbrown users 350763 May 27 06:50 boinc-hpux_32+64.tar.gz
-rw-rw-rw- 1 root sys 11125 Oct 21 2004 sha256.c
-rw-rw-rw- 1 root sys 443 Oct 21 2004 sha256.h
-rw------- 1 root sys 4 Oct 21 2004 tryme
-rw-rw-rw- 1 root sys 4 Oct 21 2004 tryme2
[root@vpart1 /home/hbrown]#


live free or die
harry d brown jr
Live Free or Die
Eric Antunes
Honored Contributor

Re: I need a UX-Windows ftp script...

Harry,

I'm using the following syntax:

d:\dados\fab_ora>rcp PLANEADO.TXT .administrator:/tmp

But I still get "remshd: Login incorrect"... :(

My user administrator is the windows system adm. user. Do I need to define a unix user called administrator?? Is your hbrown user defined on both unix and windows systems??

Thanks,

Eric





Thanks,

Eric
Each and every day is a good day to learn.
Cem Tugrul
Esteemed Contributor

Re: I need a UX-Windows ftp script...

Eric,

i have just tried same as yours and i am also
faced same error
C:\>RCP -b cemokam.txt ipaddress_of_UX.test:/users/test
: remshd: Login incorrect.
Our greatest duty in this life is to help others. And please, if you can't
Fred Ruffet
Honored Contributor

Re: I need a UX-Windows ftp script...

Eric,

You may have a resolution problem. To be sure, you can try to use IP. I did the following :

. On Unix, in my home directory
$> cat > .rhosts << EOF
10.33.200.14 fruffet
EOF
$> chmod 444 .rhosts
$> ll
total 2
-rw-r----- 1 fruffet users 16 Apr 27 10:24 essai

. On windows
T:\>rcp margaux.fruffet:essai essai.txt

T:\>dir essai.txt
Le volume dans le lecteur T s'appelle fruffet
Le numéro de série du volume est 13F2-15A6

Répertoire de T:\

27/05/2005 17:12 17 essai.txt
1 fichier(s) 17 octets
0 Rép(s) 2 134 376 448 octets libres

(-b was not used, so I have one more byte).
Important points may be
. chmod
. use IP in .rhosts file.

Note that user must not be called the same on both servers. They are really distinct. .rhosts file is here to bind them.

R
--

"Reality is just a point of view." (P. K. D.)
Eric Antunes
Honored Contributor

Re: I need a UX-Windows ftp script...

Hi Fred,

Here is my 444 .rhosts at /disc2/app/:



On windows, I do:

d:\dados\fab_ora>rcp PLANEAMENTO.TXT .:/disc2/app/

But I get the same error... :((
Each and every day is a good day to learn.