[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 417
  • Last Modified:

Bourne Shell Confirmation script

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
doctor1
Asked:
doctor1
1 Solution
 
TintinCommented:
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
 
omarfaridCommented:
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
 
TintinCommented:
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
How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

 
doctor1Author Commented:
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
 
ahoffmannCommented:
rsync has a verify option
0
 
Computer101Commented:
Forced accept.

Computer101
EE Admin
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now