First time help, please - checksum script...


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting First time help, please - checksum script...
# 1  
Old 10-05-2004
Question First time help, please - checksum script...

Hello all!

I'm a recent college grad now working for a contractor.

I've been tasked with writing a program/script that will verify that something was copied correctly.

This is how the system is used -

The user will get a distribution tape (a 4mm tape DDS3). On this tape are a bunch of files.

The user will take this tape ( all data on tape is in a tar(ball) ) - and un-tar/copy it to the disk (hard drive).

At this point my program/script should be able to verify that what was transferred from the tape is IDENTICAL to what is NOW copied to the hard drive.

So - bascially - what I'm trying to do is write a program that will check that data transmission occured without transmission errors.

I thought of using diff and cmp to compare the files but I don't know of a way to check that an un-tar operation occured without transmission errors.

Is there a way to check an un-tar operation to make sure that the data that was transferred from the tape is INDENTICAL to what is copied to the hard drive?

This command allows me to check differences between two directorys:

diff -r directory_one directory_two

How can this be used to compare what's on a tape and what's on the hard drive?

Does anyone have a better idea?
Any tips on how to start this script?

Thanks for your help!
# 2  
Old 10-05-2004
I did a checksum program for ftp transmissions using Java MD5, but perl has an MD5 too.

I wrote one program to capture the value of checksum and write it to a text file. Then sent text file along with ftp file.

Once file arrived, I used another program to compare checksum value in text file with computed checksum at ftp site.

If checksum values are equal, you're good to go.

Using checksum is the best way to verify sent ftp files and verify files for backup.
# 3  
Old 10-05-2004
MD5 is great, but a CRC is pretty good too. And you probably have the program cksum that can compute CRC's for you. cksum outputs two numbers: a byte count and a crc-32. I capture both numbers and check them both.

Either way, this must start before the tape is made. On the source system, you need to do a cksum on some files and send the ouput to a text file. Then you tar up your files together with this text file. Once you untar the files on the destination system, you rerun cksum and compare the results to the text file.
# 4  
Old 10-05-2004
Thanks for the quick responses...

This is the main problem that I'm having. I understand the whole concept. Just not sure how to implement it.

The 4mm tape is created before hand. Therefore I can't create a checksum on the source data.
(actually since I haven't seen the original source code for this process I haven't been able to verify if this is true)

I can only verify the destination data.

Here's an example:

The user has a 4mm tape. On this tape is some data. The user will transfer (un tar) the data to the hard drive. The user will then use this data to create other copies onto other hard drives.

I want to verify that what's on the tape is EXACTLY what is NOW on the hard drive.

(as a sidenote - is there some kind of option that can be used within the tar command itself to verify that transmission occured error free???)

I just did a quick experiment with the cksum command.

I did:

cksum /dev/tape/tape0
It returned: some number another number /dev/tape/tape0

I was thinking I could then un-tar the contents of the tape to the hard drive and then do a cksum on the directory.

For example: cksum /temp_directory
BUT - when the command is used on the temp directory another number is returned!!! Not the same cksum value. Obviously something is happening that I'm not aware of.


Anyone have any insight to this problem?f
# 5  
Old 10-05-2004
You're not really going to be able to do that. About as close as you can come would be to untar the tape twice and compare both disk copies.
# 6  
Old 10-06-2004
I'm still thinking about this one!

Would any of you happen to know if the tar command ITSELF has some kind of checksum algorithm that is used when something is un-tarred?

This would be for Tru64 unix.

If the above is true then I really don't need to do a checksum routine on the tar operation, correct?
# 7  
Old 10-06-2004
Tar does not checksum stuff. However dds drives employ a crc and if the crc is wrong, they attempt to use a ecc to correct the data. If that fails, a read error is declared.

See this link.

And this link.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Need UNIX script to check checksum and dummy file creation.

Hi Folks, I need a UNIX script which will copy files(Table wise) from source directory to destination directory (Under table directory) and also creates 2 additional files after getting copied to destination directory with extension .pdy and .ldy , . pdy file will be zero byte file should get... (4 Replies)
Discussion started by: Nicks1412
4 Replies

2. Shell Programming and Scripting

Script to get checksum of itself

is there a way to get a script to do a checksum on itself? something like this: #!/bin/sh myexpectedsig=$(cksum $0 | awk '{print $1}') if ; then exit else who uptime date fi im looking for something that would always represent the running script, which is why im... (6 Replies)
Discussion started by: SkySmart
6 Replies

3. Shell Programming and Scripting

Needed script to FTP a File and generate a quality checksum file

hi all i want a script to FTP a file and should generate a quality checksum file means when I FTP a file from one server to another server it should generate a QC file which should contain timestamp,no.of records in that file Thanks in advance saikumar (3 Replies)
Discussion started by: hemanthsaikumar
3 Replies

4. Shell Programming and Scripting

Ftp script hangs for first time,but works every second time

Hi I have an ftp script which works fine when i execute through a test scheduler(UC4), but when i run it through the prod scheduler(UC4), it hungs indefinetely, when we cancel the job and re-run it it works perfectly fine. here is the code,, any idea why this is happening ???? ... (1 Reply)
Discussion started by: selvankj
1 Replies

5. Shell Programming and Scripting

what would a script include to find CPU's %system time high and user time high?

Hi , I am trying to :wall: my head while scripting ..I am really new to this stuff , never did it before :( . how to find cpu's system high time and user time high in a script?? thanks , help would be appreciated ! :) (9 Replies)
Discussion started by: sushwey
9 Replies

6. IP Networking

Wireshark UDP checksum bad checksum

Hello I am communicating with two devices using my computer over UDP protocol. The application is running fine. When I monitored the UDP traffic using Wireshark software, I found that there were too many Checksum errors. Please find attached the png file showing this error. I am about to... (0 Replies)
Discussion started by: AustinCann
0 Replies

7. Shell Programming and Scripting

Checksum+SFTP

Hi ALL, I use solaris OS and SFTP to get/put files from remote server.I use the below command , sftp user@host<<EOF cd "dir" get --checksum "filename" EOF I am getting a strange error as " get --checksum INVALID paramter". It has been working succesfully since last 3 years but all of a... (1 Reply)
Discussion started by: mohanpadamata
1 Replies

8. Shell Programming and Scripting

Shell script to convert epoch time to real time

Dear experts, I have an epoch time input file such as : - 1302451209564 1302483698948 1302485231072 1302490805383 1302519244700 1302492787481 1302505299145 1302506557022 1302532112140 1302501033105 1302511536485 1302512669550 I need the epoch time above to be converted into real... (4 Replies)
Discussion started by: aismann
4 Replies

9. Solaris

checksum

Anyone can tell me the different between "cksum" and "sum" command on Solaris? I read the man pages but still not get it. And how to display the md5 checksum for a file. Thanks, (1 Reply)
Discussion started by: redstone
1 Replies

10. SCO

checksum

Does anyone know the answer to this? When I run "sum -r" on a file that I've down loaded from the sco website, the 1st set of numbers differs from the checksum on the download page but the 2nd set matches. If I try to install the patch, I get errors. Anyone has an answer? (3 Replies)
Discussion started by: jn5519
3 Replies
Login or Register to Ask a Question