Solved

Bourne Shell Confirmation script

Posted on 2007-11-21
7
405 Views
Last Modified: 2013-12-26
trying to veryfy data sent and data received using sum command are the same.
how do i set them in a script using bourne shell from sending server.
0
Comment
Question by:doctor1
7 Comments
 
LVL 48

Expert Comment

by:Tintin
ID: 20331312
How are you sending the data?

To do the check in a script, you do

sum1=`cat /path/to/sent_file | sum`
sum2=`cat /path/to/received_file | sum`

if [ "$sum1" = "$sum2" ]
then
     echo "Both files have the same checksum, so they are probably the same, although to be really sure, I should be using MD5 checksums"
fi
0
 
LVL 40

Expert Comment

by:omarfarid
ID: 20334254
Hi,

Tintin:

What about bin files? I guess cat will not work.

Anyway, I will asume that both m/c are unix, you can use

cksum filename > filename.cksum

This will produce numbers that are stored in filename.chsum

Then you may transfer both files and again run chsum on the received file and compare results with the 2nd file.


http://www.hmug.org/man/1/sum.php
0
 
LVL 48

Expert Comment

by:Tintin
ID: 20336656
cat works perfectly fine with binary files.

doctor1, I've just noticed that you have rsync listed in the tags.  Are you using rsync for the file transfer?
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:doctor1
ID: 20348066
My script will copy 4 DB files to different Directoyin local server, then that directory will be transferred using rsync to another server like: cp -p /abc/def/*.old /abc/def/ghi,
using rsync like: rsync -avz /abc/def/ghi -e ssh -l SybaseUser@serverB:/abc/def/ghi; Then I tried like:
[[sum /abc/def/ghi  > file1; from sercver A, and from server B: sum /abc/def/ghi > file2, after that rsyncing back and forth file1 and file2 like: rsync -avz /var/tmp/file1 -e ssh -l SybaseUser@serverB:/var/tmp/file1; From serverB, rsync -avz /var/tmp/file2 -e ssh -l SybaseUser@serverA: /var/tmp/file2, Now both serverA and B have  :/var/tmp/file1 and  :/var/tmp/file2;
I could verify file1 and file2 are equal from either server]], my question is rather than doing all within [[...]],
how I could verify all from server A in a script that " sum /abc/def/ghi (sent from serverA) =  sum /abc/def/ghi  (received by serverB with a time stamp, like using a place hilder), if so, create a file in serverB:(from serverA)like: touch OK2LoadDBfile; and if this file is seen in server B , loading script will be executed.
I Thank expert team members in advance for their guidence using Bourne shell script in Solaris environment and trying to improve my skills as well.
 
0
 
LVL 51

Accepted Solution

by:
ahoffmann earned 500 total points
ID: 20351840
rsync has a verify option
0
 
LVL 1

Expert Comment

by:Computer101
ID: 20659578
Forced accept.

Computer101
EE Admin
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

The following is a collection of cases for strange behaviour when using advanced techniques in DOS batch files. You should have some basic experience in batch "programming", as I'm assuming some knowledge and not further explain the basics. For some…
Utilizing an array to gracefully append to a list of EmailAddresses
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Concerto provides fully managed cloud services and the expertise to provide an easy and reliable route to the cloud. Our best-in-class solutions help you address the toughest IT challenges, find new efficiencies and deliver the best application expe…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now