Operating System - HP-UX
1850763 Members
3366 Online
104055 Solutions
New Discussion

Re: FTP and bytes statistic

 
SOLVED
Go to solution
Luis Toro
Regular Advisor

FTP and bytes statistic

 
11 REPLIES 11
David Burgess
Esteemed Contributor

Re: FTP and bytes statistic

What do you need to know?

Regards,

Dave.
Luis Toro
Regular Advisor

Re: FTP and bytes statistic

[inadvertently submitted question without any text...]

I have an FTP script whereby I redirect the output of an ftp "put", then I grep for "bytes sent" and compare against the size of the file to report on FTP success or failure. I noticed that if a file is 0 bytes I do not get the "bytes sent" line. Scripted around that shortcoming. However, on a particularly long ftp ( 11 gig. in 9 hours ), I did not get the "bytes sent" stat after the "Transfer Complete" line. This caused my script to report a failed FTP when in fact it was successful.
Is this a "bug" ? Is there a way to ensure I always get the "bytes sent" line.

Thank you
David Burgess
Esteemed Contributor

Re: FTP and bytes statistic

This works.

ftp -nv << EOF > /tmp/ftplog.dave 2>&1
open 0
user username password
ascii
lcd /etc
cd /tmp
put hosts
bye
EOF

grep bytes /tmp/ftplog.dave

I always get bytes sent in the logfile, although I have only run it a few times.

Regards,

Dave.
Luis Toro
Regular Advisor

Re: FTP and bytes statistic

Dave,
that is exactly what I'm doing.
I've attached a word doc which has the function I scripted to transfer the files, along with the log output. The very first ftp is the one that has the issue: no "bytes sent" line after the "Transfer Complete".
The other FTPs have that line, with the exception of the 0 bytes files.
David Burgess
Esteemed Contributor
Solution

Re: FTP and bytes statistic

I see your ftp server is

FTP server (Version 1.1.214.4(PHNE_27765) Wed

You could try installing PHNE_29461 on the server you are ftp'ing to.

http://www4.itrc.hp.com/service/patch/patchDetail.do?BC=patch.breadcrumb.main|patch.breadcrumb.search|&patchid=PHNE_29461&context=hpux:800:11:11

It fixes the follwing:-

1. JAGae85593/SR8606323128.
Under certain conditions ftpd does not work properly.

2. JAGae69021/SR8606305973.
ftp generates an incorrect transfer report while
storing files of size more than 2 GB.

3. JAGae58493/SR8606294799.
'get' command of ftp does not function properly.

Hope that helps

Regards,

Dave.
Bill Hassell
Honored Contributor

Re: FTP and bytes statistic

You might want to take the opposite approach. After the put command, use the dir command for the transferred file and extract the size from the fifth field as in:

dir /etc/hosts
200 PORT command successful.
150 Opening ASCII mode data connection for /usr/bin/ls.
-rw-r--r-- 1 bin bin 1755 Feb 26 20:19 /etc/hosts
226 Transfer complete.

SIZE=$(grep $MYFILE ftp_log | awk '{print $5}'


Bill Hassell, sysadmin
Bill Hassell
Honored Contributor

Re: FTP and bytes statistic

You might want to take the opposite approach. After the put command, use the dir command for the transferred file and extract the size from the fifth field as in:

dir /etc/hosts
200 PORT command successful.
150 Opening ASCII mode data connection for /usr/bin/ls.
-rw-r--r-- 1 bin bin 1755 Feb 26 20:19 /etc/hosts
226 Transfer complete.

SIZE=$(grep $MYFILE ftp_log | awk '{print $5}')

Tha way, you can be sure of the remote size rather than relying on a transfer status report.


Bill Hassell, sysadmin
Luis Toro
Regular Advisor

Re: FTP and bytes statistic

Bill, Dave:

Thanks for your input. The patch description certainly points to the problem I'm having, but Bill's suggestion is the simpler one to implement, and is probably more reliable in terms of what I'm trying to do.

Thank again.
Steven E. Protter
Exalted Contributor

Re: FTP and bytes statistic

I have just learned that webalizer can be used to analyze and provide statistics on the ftp log.

Here is a link.
http://hpux.connect.org.uk/hppd/hpux/Networking/WWW/webalizer-2.01.10/



Its not easy to install and this install is missing the primary config file, but I can provide that.

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
Magnus Andersen
Advisor

Re: FTP and bytes statistic

Steven,

Could you pass your installation expertise with webalizer along. I'd very much like to have it installed on one of my webservers running HP-UX 11

magnus.andersen@walkerfirst.com

Thanks,

Magnus
Geoff Wild
Honored Contributor

Re: FTP and bytes statistic

Awstats will also do this for you - works with http, mail, ftp...etc.

http://awstats.sourceforge.net/

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.