Solved

SYNC between Two directories

Posted on 2008-10-25
11
1,258 Views
Last Modified: 2012-06-22
I want to sync files and directores between two directories  even sub directories under   below that directories wtih shell scripts.

example
/mnt/test1
/mnt/test2

both test2 must sync with test1 with shell script and i wat to schdule shell script under cron job every mid night


0
Comment
Question by:vadicherla
11 Comments
 
LVL 9

Expert Comment

by:chingmd
ID: 22806303
You will want to look at the command rsync.  

0
 
LVL 9

Accepted Solution

by:
chingmd earned 250 total points
ID: 22806304
without testing.   this is something of what it'll look like.

rsync avr --delete /mnt/source /mnt/destination
0
 
LVL 48

Assisted Solution

by:Tintin
Tintin earned 250 total points
ID: 22806325
You don't need a script, just define a cronjob as

0 0 * * * rsync -a --delete /mnt/test1 /mnt/test2
0
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 
LVL 68

Expert Comment

by:woolmilkporc
ID: 22807863
Hi,
if you don't have rsync installed, you can obtain it hetr
http://rsync.samba.org/
wmp
0
 

Author Comment

by:vadicherla
ID: 22807958
Does rsync also verify the time stamp on file. If we have same file on both directories . i still need to copy the file from A to B because it modified

Thanks
Sudhakar
0
 
LVL 68

Expert Comment

by:woolmilkporc
ID: 22807999
Thats one of the most important features of rsync
0
 
LVL 9

Expert Comment

by:chingmd
ID: 22817493
As well as you can set it to check checksums on the file.  So if for some reason you are not keeping Atime and Mtime on the filesystem rsync will still keep the files in sync.
0
 
LVL 9

Expert Comment

by:chingmd
ID: 22817499
Oh yeah!  it's also a great tool for remotely keeping files in sync..   so you have have an off machine backup.
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Install Predefined Certificate on Ubunto 4 39
Video Streaming 6 73
How to install Ubuntu 16 in DELL venue 8 pro 20 153
Choosing CentOS 16 81
The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
Fine Tune your automatic Updates for Ubuntu / Debian
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

777 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