Solved

Bourne Shell Confirmation script

Posted on 2007-11-21
7
408 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
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

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

 

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

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

Question has a verified solution.

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

This Windows batch file is useful for organizing image files from a digital camera or other source, but can have many other uses.  It simply renames the file(s) to match their create date.  For example, if you took a picture today at 1:40pm and the …
Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
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…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

791 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