Solved

Best method to verify unix cp command was successful

Posted on 2008-06-23
1
1,873 Views
Last Modified: 2013-12-27
In database environment need to absolutely verify that cold backup files are saved to alternative location.  I have approximately 20 files that are 2GB each.  My only thought is to use the unix "cmp" command to verify files have been copied successfully ( e.g. source matches copy byte for byte ).  What about running a checksum, unix command "sum"?
0
Comment
Question by:sdruss
[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
1 Comment
 
LVL 48

Accepted Solution

by:
Tintin earned 500 total points
ID: 21852373

#!/bin/sh
src_sum=`sum /src/file | awk '{print $1]'`
dst_sum=`sum /dst/file | awk '{print $1}'`
 
if [ $src -eq $dst ]
then
   echo "Checksums are the same"
else
   echo "Checksums differ"
fi

Open in new window

0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying 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

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 …
FreeBSD on EC2 FreeBSD (https://www.freebsd.org) is a robust Unix-like operating system that has been around for many years. FreeBSD is available on Amazon EC2 through Amazon Machine Images (AMIs) provided by FreeBSD developer and security office…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:

726 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