Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Bourne Shell Confirmation script

Posted on 2007-11-21
7
Medium Priority
?
415 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

 

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 2000 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

Tech or Treat! - Giveaway

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

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

Over the years I've spent many an hour playing on hardened, DMZ'd servers, with only a sub-set of the usual GNU toy's to keep me company; frequently I've needed to save and send log or data extracts from these server back to my PC, or to others, and…
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…
Suggested Courses

636 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