Confirming Remote Copy


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Confirming Remote Copy
# 1  
Old 11-10-2010
Confirming Remote Copy

Hey guys.

I'm knocking up a script, a part of which will be copying some pretty large files to some remote servers. With the size of the files I need to make sure that they don't lose any data / corrupt on the way (it's unlikely, but these are business critical).

Obviously I could use the exit code to confirm the copy completed successfully but I assume that it wouldn't know if any data was lost.

The option I've thought of is to do a checksum on the file being copied, and do a remote checksum once the copy is completed and compare the two. But was just wondering if anyone could think of a neater way of doing it.

Thanks.
# 2  
Old 11-10-2010
Quote:
Originally Posted by dlam
Obviously I could use the exit code to confirm the copy completed successfully but I assume that it wouldn't know if any data was lost.
Of course it would! Actually this is what the so-called "flow control" of the network layer is for - make sure that no packet is lost or at least make sure such a loss is noticed.

If you do some "scp /file/here user@host:/file/there" and it comes back with RC=0 you are guaranteed that the transmission was: 1) successful; 2) complete.


Quote:
Originally Posted by dlam
The option I've thought of is to do a checksum on the file being copied, and do a remote checksum once the copy is completed and compare the two. But was just wondering if anyone could think of a neater way of doing it.
If you are really paranoid (which is, btw., a fitting attitude for a systems administrator and there is absolutely nothing wrong about it) you could of course check the checksums of both the local file and the remote copy.

There is a freeway utility called "md5sum" (download here), which is included in many Linux distributions. Perhaps it can be compiled for most other Unix systems too. It should be well suited for your purpose.

I hope this helps.

bakunin
# 3  
Old 11-10-2010
Ah right, thanks for that. I assumed the return code would be that the copy command had completed successfully, not that the data copied was duplicated (if that makes sense).

Might do a basic cksum check as well just to be sure. But sounds like that'll be enough.

Thanks,
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Copy from local to remote

Hi I need a advice for writing simple bash script, I have a file pod.txt which contains source location and remote location: /mnt/infile/20141103/701_0001.png/remote/tmp/pk21730/p0330223723074.png /mnt/infile/20141103/203_0001.png/remote/tmp/pk21731/p0330223723081.png and I must copy ... (6 Replies)
Discussion started by: primo102
6 Replies

2. UNIX for Dummies Questions & Answers

Remote copy through shellscript

I am using RedHat 4.4 Version Operating System. I want to copy one file from source to destination.I don't want to give a password when I am executing the below shell script. code: #!/bin/bash scp -r file.zip 192.168.1.5:/root/ Here it asking a password to enter,Is there any way give a... (2 Replies)
Discussion started by: kannansoft1985
2 Replies

3. Shell Programming and Scripting

Confirming a string

Hi Guys, I have files that are sent to me in this format: Copy of USer Database updated 23 JANUARY 2013.csv I am developing a script to load these files to my database automatically whenever I get these files: How do I verify these files in an if statement if I do have these files? ... (5 Replies)
Discussion started by: Phuti
5 Replies

4. UNIX for Advanced & Expert Users

Using remote rsync, but copy locally?

I'm looking to use rsync to compare remote files and to copy the diff to a local directory, rather than transfer over the net. The net connection is not fast enough to transfer these files (~1.8TB) and I'd like to sneakernet them instead. Possible? (4 Replies)
Discussion started by: dfbills
4 Replies

5. Shell Programming and Scripting

Remote Copy Script

Hi All, My first post on the Forums! I've just whipped up a quick script to slightly automate a log file retrieval process for work and to be completely honest my BASH scirpting knownledge is extremely limited as is my understanding of a lot of linux commands. Basically the scripts purpose... (3 Replies)
Discussion started by: effektd
3 Replies

6. AIX

Confirming command

Guy's I'm trying to create script to execute some critical commands in AIX like the below ... stopsrc -s qdaemon stopsrc -s sshd stopsrc -s lpd stopsrc -s nfsd I want between each command to ask me like this " are you sure to stop qdaemon " " are you sure to stop ssh" " are... (3 Replies)
Discussion started by: Mr.AIX
3 Replies

7. UNIX for Dummies Questions & Answers

Copy files between remote hosts

Don't know if its correct to write into this topic but how can I copy files from a Windows machine to a UNIX system? (2 Replies)
Discussion started by: agasamapetilon
2 Replies

8. Shell Programming and Scripting

Confirming Syntax - IF statement.

Hi All, Has been a while since I was last on, so I hope everyone has been doing fine. ;) Would like to know if the below IF statement syntax is correct for a ksh environment. It's been pushed into live as someone had deleted the development copy(!); not withstanding that, the statement now... (3 Replies)
Discussion started by: Cameron
3 Replies

9. HP-UX

help me to copy remote file

I want to copy dump generated from oracle database to my local DAT drive. Currently I am copying remote file to local drive thru rcp command and later copy it to local DAT. Pls. help me in this. Thanks Man Mohan email address removed (8 Replies)
Discussion started by: manmohan73
8 Replies

10. UNIX for Dummies Questions & Answers

Remote file copy

I facing a problem with Unix command "rcp". I unable to perform a rcp between host machines. I have religiously followed the man pages, but still unable to solve the problem. Do i check for anything to perform this command? Pls help....thanks =) (3 Replies)
Discussion started by: lchunl
3 Replies
Login or Register to Ask a Question