ftp file verification


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting ftp file verification
# 1  
Old 10-07-2003
ftp file verification

I need a simple method to verify that an automated ftp script was successful. The ftp command can exit without error and the file may not have been successfully sent. It's rare, but it happens.

I could write a script that would use md5sum before and after sending the file. But, what I really want is an open source ftp program that does this for me! It would exit non-zero if the files are not the same. Does such a beast exist???

If not, what is the best way to accomplish ftp file verification?
Thanks,
# 2  
Old 10-07-2003
The problem with your plan is that you can't compute a checksum on a remote file via the ftp protocol. It would be cool to add a checksum option into the protocol. This could be done via the site command. But until everyone else agrees with this and modifies the servers and clients we are stuck with what we have.

You could lcd to another directory and retrieve the file again. Then compare the original file with the one that made the round trip. If they are identical, it pretty certain that the remote copy must also be ok.
# 3  
Old 10-07-2003
Why not check the sizes of the two files to verify they are the same? Use the SIZE command.

Definitley not as precise as MD5 but it still might come in handy.
# 4  
Old 10-08-2003
We currently retrieve the file via ftp to verify that the first ftp session was valid. Needless to say it multiplies network traffic and increases the complexity of the entire process.

Having said that, it would seem that ftp should be able to internally compute the checksum before and after the transfer, then ftp "get" the checksum from the remote server to verify the comparison? Just wishful thinking. I am not expecting this to happen and I don't have time to build it myself...

I find it surprising that this issue has not frustrated enough people to make an ftp verification process.

We don't have the SIZE command on our Solaris boxes. I will play with it on my home Linux box...
Thanks and best regards!
# 5  
Old 10-08-2003
Why dont you just keep a log of your ftp activity and check this post the ftp'ing of the file?

ie.
ftp -vn -T 5 << endftp2 > ftplog
open <server>
user <username> <passwd>

put filename
bye
endftp2



Then you can grep the logfile for errors etc.
# 6  
Old 10-08-2003
ftp log files

Our ftp processes have very good log files. This still does not capture some network issues. We can have good log files yet the ftp process somehow failed.

I need a process to verify that the files are the same... Consider this, these files may be overwritten because they have the same file name (where a timestamp is not allowed). This is where checksum is a good tool.
# 7  
Old 10-09-2003
A long time ago an ftp process was done on SUN servers at my workplace where the map database file is sent to other servers and then a check file was sent. The check file contained the output of ls -s of the map database file. It was checked against the ftp'd file. (The second file with the size also allowed us to know when the first file was completly sent and not still being sent).

set knownsize = `cat $ftphome/ftpOVready|awk '{print $1}'`
set thissize = `ls -s $ftphome/openview-$today.tar |awk '{print $1}'`
if ("$thissize" != "$knownsize") goto files-missing

This was part of the code (in csh).

I don't see why you couldn't do the same unless it's going to a non-UNIX system.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Programming

ECDSA verification

Using ECDSA, how do you verify integrity of Data (D), Given the value for the following: Random number (r) Signature (s) ECpublic Key (K) Thanks. (0 Replies)
Discussion started by: dragonpoint
0 Replies

2. Shell Programming and Scripting

Verification of file name with table column

I am trying to generate code 1. move entire list of file names with specific pattern(standard patterned name for example file name is <process>_<country>_<yymmdd>) in a directory to a variable 2. Use variable in netezza code to check file name exist in a table or not? for example: Employee... (1 Reply)
Discussion started by: JayDoshi
1 Replies

3. Shell Programming and Scripting

Help about comment verification

Hello, I have a file, in which line 40 is commented. It is basically a cron job, #05,35,50 * * * * /usr/local/scripts/my.sh how i can i verify the line 40 is commented, if not then give me message not commented, otherwise provide us message it is commented. (5 Replies)
Discussion started by: learnbash
5 Replies

4. Shell Programming and Scripting

Script Verification

Hi eveyone I am planning to use crontab to delete all files in my donwloads directory that are older than one hour I will be using crontab to run this script find /home/kee/downloads/* -daystart -mmin +59 -type f -name -exec rm -r {}\; could you please let me know if the above... (1 Reply)
Discussion started by: k33k00
1 Replies

5. HP-UX

[Solved] Unable to rename file in ftp server .Net:FTP perl

Hello All, I am trying to connect to ftp server and get the files. Also i need to rename the file in other ftp dir. rename method is not allowing me to rename the file in other dir. When i tried copy command by using net::FTP:FILE then perl says it is not installed. Can some body help me to... (2 Replies)
Discussion started by: krsnadasa
2 Replies

6. UNIX for Dummies Questions & Answers

FTP Status verification

Do we have any defined error code for FTP status (2 Replies)
Discussion started by: krissathish
2 Replies

7. UNIX for Advanced & Expert Users

Using FTP to check whether file is completely FTP... plz find the description below

Hi, We have some clients who will place huge files in to one of the remote server. And the shell script written in our local server to retrieve client files (using FTP) placed on one of the remote server of ours by clients. My question Is there any FTP command/script to check from my local... (1 Reply)
Discussion started by: nmsrao
1 Replies

8. Programming

htable + verification

hello every body, I have to verifiy if the param_key is selectionned twice or more and to print only one occurence i'm using htable what's the good implementation to add to the code to verify this. code : { char *tmpStr = NULL; ght_iterator_t iterator_param; void... (0 Replies)
Discussion started by: kamel.seg
0 Replies

9. Shell Programming and Scripting

FTP script to FTP file to UNIX - Solaris

Hello, A couple of times per week, i receive emails notifications when files are available for processing. Currently i read these eamails with a java program and store the attachement on my C: drive and would now like to generate a PC script to send this file name up to UNIX-Solaris and... (3 Replies)
Discussion started by: bobk544
3 Replies

10. UNIX for Dummies Questions & Answers

verification?

I'm really new at this and wondering how I would go about adding code to my script to verify that all records loaded successfully? (I am loading a file into a table) i'm using the Korn shell. I'm also having trouble verifying parts in the header as i do not really understand the header and... (3 Replies)
Discussion started by: sheranjem
3 Replies
Login or Register to Ask a Question