cancel
Showing results for 
Search instead for 
Did you mean: 

FTP Program advice

 
djoshi
Frequent Advisor

FTP Program advice

Hello all,

I want any FTP program to transfer files between two HP-UNIX 10.02 machine and which tells us the reason if the FTP fails?

Can any one advice me on this.
11 REPLIES
James R. Ferguson
Acclaimed Contributor

Re: FTP Program advice

Hi:

> I want any FTP program...

What does that mean, a script to leverage FTP?

In a shell, you might capture an FTP session's information with verbose logging:

# ftp -in -v >> /var/tmp/ftplog.$$ 2>&1

You could then parse the log looking for specific strings of text and/or the specific replies made by the FTP daemon. Each reply begins with a three-digit value. Look at the manpages for 'ftpd(1M)' for how to interpret these and/or their textual description. Be advised that the actual text may vary among different server implementations.

In Perl, you could use the 'Net::FTP' module. This allows straightforward logic, like:

$ftp->login() or die "..."

...and:

$ftp->put($localf, $remotef) or die "..."

...which gives you the ability to report whatever and however you like.

Regards!

...JRF...
Steven E. Protter
Exalted Contributor

Re: FTP Program advice

Shalom,

You may wish to try snarf.
http://hpux.cs.utah.edu/hppd/hpux/Networking/FTP/snarf-7.0/

It may be a new version, if so search the parent site for snarf

Or a script.

ftp -i -n -v <<-ftpend


open maquina_remota


user Nome_do_Usuario password


binary


cd /diretorio_remoto


lcd /diretorio_local


get arquivo_remoto


put arquivo_local


quit


ftpend

You will get diagnostics. No promise that it will be actually useful information. It is after all Unix. Beats a crashing windows gui.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Steven Schweda
Honored Contributor

Re: FTP Program advice

> [...] HP-UNIX 10.02 [...]

HP-UX 10.20?

uname -a

Where did you find an FTP program which does
_not_ tell you the reason if the FTP fails?
What, exactly are you trying to do?
djoshi
Frequent Advisor

Re: FTP Program advice

Thx for suggestion.

can you please advise me how about ncftpput? Is anybody use this ftp program? if yes, Please advise me for HP-UNIX?

http://www.ncftp.com/

Thx,
Steven E. Protter
Exalted Contributor

Re: FTP Program advice

Shalom,

I've used the client, a few years ago.

I did not find it very inspiring.

If you are looking for a client, see snarf or if filezilla can be compiled on your Unix box.

As far as ftp server goes, whenever possible I shut it down and don't use it all all. Clear text authentication scares me.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Steven Schweda
Honored Contributor

Re: FTP Program advice

> [...] can you please advise me [...]

You might get better advice if you explained
exactly what you wish to do.

And before asking here about some third-party
product, you might try to explain why the
built-in software is not good enough.
djoshi
Frequent Advisor

Re: FTP Program advice

Below is what I am trying to do.

We already have ftp program to transfer files and we are using default ftp for this.

Sometimes the ftp program is failing and we don't know the reason of fail. That's why we need a program which tells us the reason why the ftp is failing. Is ftp return any exit codes of fail?

Please advice me how to accomplish my requiremet.

Thx,


Tingli
Esteemed Contributor

Re: FTP Program advice

You can use:

ftp -inv -T 12 $REMOTESITE < ftp_info | grep 226

to check the error.
Steven Schweda
Honored Contributor

Re: FTP Program advice

> Sometimes the ftp program is failing and we
> don't know the reason of fail.

What do you do? What happens when it fails?
"is failing" is not a useful problem
description.

> Is ftp return any exit codes of fail?

Most programs emit error messages when they
fail, or exit with some failure status. What
does yours do? Are you looking at what it
does? What makes you think that some other
program will tell you more than this one
does?



> [...] | grep 226

What happens if you get some other error
code?
Bill Hassell
Honored Contributor

Re: FTP Program advice

> tells us the reason if the FTP fails...

As mentioned, ftp will tell you exactly why it failed. The problem is that there are dozens of reasons for the failure.

Start with the initial connection:
- Is the hostname or IP address valid?
- Can you reach the host/IPaddr (ie, ping)?
- Did the login and password work OK?

Now the endless tasks that you can perform:
- lcd to the desired local directory OK?
- cd to the desired remote directory OK?
- dir OK?
Is the the expected location? Are there permission problems or misspelled paths?

And finally the transfer:
- get or put succeeded?
- mget or mput succeeded?
- For mput/mget, did the expected number of files get transferred?

And finishing:
- set permissions (if allowed, site and quote commands)
- verify file sizes

I suspect that you want just a simple command with a 0 or 1 return code. But as you can see, there are many, many reasons for failures. So once you know there's a failure, the first question should be what went wrong? And that requires extensive scripting to test the text from ftp and extract the error conditions.

There is a scripting tool called expect that (after a steep learning curve), could be used to implement a complete solution. I have described a completely general scenario above -- you can create custom scripts for specific tasks, but you'll have to assume that every step will fail and test for that condition.


Bill Hassell, sysadmin
djoshi
Frequent Advisor

Re: FTP Program advice

Thx all for your help and advice. We dropped the idea of using the third party FTP program.

Thx,