Operating System - HP-UX
1837515 Members
3662 Online
110117 Solutions
New Discussion

Send files from W2K to HP-UX Servers

 
SOLVED
Go to solution
Mary Rice
Frequent Advisor

Send files from W2K to HP-UX Servers

Hello Forum Guys,

Perhaps I should post this in another forum but I think my luck will be better here. Once a week, a client needs to send 3 large text files for import into a database running on HP-UX 11i. The client insists that we do an FTP push but it must be automatic. All they want to do is run a batch file when the transfer is ready and leave for the day. The batch file is then supposed to log them in and start sending. W2K has an FTP client but I haven't been able to script anything that works. Does anybody have any suggestions?

Thanks and please help,
Mary Rice
8 REPLIES 8
Jeff Schussele
Honored Contributor

Re: Send files from W2K to HP-UX Servers

Hi Mary,

I'd recommend, in this order:

1) perl along with it's ftp module - powerful & capable.

2) expect language - as it's designed for response/reply type scenarios such as logins.

Either way you'll have to deal with the issue of usernames & PWs in clear-text in these scripts. May want to look at using the HP-UX command crypt to encrypt these values in the script and decrypt them during execution.

Rgds,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
A. Clay Stephenson
Acclaimed Contributor

Re: Send files from W2K to HP-UX Servers

Hi Mary:

If this were me, my weapon of choice would be Perl. The Net::FTP module makes this rather easy. Is Perl an option for you and your client?

If the client insists on a .BAT file then you done got yourself the wrong boy.

Regards, Clay
If it ain't broke, I can fix that.
Mary Rice
Frequent Advisor

Re: Send files from W2K to HP-UX Servers

Hi Guys:

Thanks for the quick reply. Perl would be fine as long as it is not too expensive and is easy for the user to use. Is there a demo version that I can try?

Mary
A. Clay Stephenson
Acclaimed Contributor

Re: Send files from W2K to HP-UX Servers

How about free (and it's good Perl).

http://www.activeperl.com/

You will also need the Net::FTP module (I don't think it's supplied from ActiveState) but you can download it from www.perl.org/CPAN.

If it ain't broke, I can fix that.
Patrick Wallek
Honored Contributor

Re: Send files from W2K to HP-UX Servers

Mary,

I just got this to work on my Windows XP pro machine. It requires 2 files to do the job though.

FTP.BAT

ftp -i -n -v -s:FTP.TXT

FTP.TXT
user username password
dir
bye


I got this from the Windows XP help for their FTP command.

In short, the -s option lets you specify a file that contains FTP commands to run. So when you execute the FTP.BAT file it will run FTP and then FTP will call the FTP.TXT file to login and do whatever else is contained in that file.

I hope this helps you.
A. Clay Stephenson
Acclaimed Contributor
Solution

Re: Send files from W2K to HP-UX Servers

Hi again Mary:

I might as well get you started:

ftpput.pl file1 file2 file2

will login, cd to /tmp, go to ascii mode, and then start transferring file1, file2, and file3. Error checking is done and it will attempt 5 retries before giving up.

You can avoid the plaintext passwd by using .netrc. I made those comments in the code.

At some point, it looks like I am going to have to give this routine some options for hostname, directory, and pass in the user and optional passwd so that everything can be driven from the command line.

This should be very close to what you need.

Now go play with your Perl, Clay
If it ain't broke, I can fix that.
Wodisch
Honored Contributor

Re: Send files from W2K to HP-UX Servers

Hi Mary,

don't use FTP (or TELNET) any more, as those transmit passwords in plain text :-(

Since HP finally supports SSH ="SecureSHell"(OpenSSH), which comes with SCP = "SecureCoPy", use that:
scp sourcefile user@unix:/targetdir
ssh -l user unix batch...

much better...

And you can get SSH/SCP for free for W2K from CYGWIN!

Wodisch
Frank Slootweg
Honored Contributor

Re: Send files from W2K to HP-UX Servers

Wodish's scp+ssh approach is probably best (most secure), but if you do not need high security, you can use the rcp(1) and rsh(1) (remsh(1) on HP-UX) commands which come standard with W2K.

I use that all the time between my W2K 'workstation' and my HP-UX systems. Since rcp can copy both ways and you can use rsh to execute a script on the HP-UX system, there isn't much which you can not do this way. I even have W2K Scheduled Tasks which execute .bat files to do everything automatic.