Solved

Bourne Shell Confirmation script

Posted on 2007-11-21
7
403 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
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 

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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Background Still having to process all these year-end "csv" files received from all these sources (including Government entities), sometimes we have the need to examine the contents due to data error, etc... As a "Unix" shop, our only readily …
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…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

758 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

19 Experts available now in Live!

Get 1:1 Help Now