You are not logged in.

#1 2005-03-14 12:56:14

Cotton
Member
From: Cornwall, UK
Registered: 2004-09-17
Posts: 568

Directory syncing

Whats the easiest and/or best way to keep 2 subdirectories on 2 different PCs in sync for the following two situations:

In one case, only one directory changes its contents, in the other, either directory could be modified.

After sync'ing, the contents of the directories should be identical.

Offline

#2 2005-03-14 13:37:00

puntmuts
Member
Registered: 2005-02-22
Posts: 138

Re: Directory syncing

I think rsync could do this.  But there are other (desktop) solutions as well. For example a program called Krusader could handle this as well (manually) .


Out / Gone
Mirgrating all my machines off ArchLinux . No longer part of the ArchLinux community / users .
Done. Goodbye.

Offline

#3 2005-03-14 14:56:05

jerem
Member
From: France
Registered: 2005-01-15
Posts: 310

Re: Directory syncing

rsync is THE application for that job, it was created for that !

Offline

#4 2005-03-14 14:58:01

soloport
Member
Registered: 2005-03-01
Posts: 442

Re: Directory syncing

Cotton wrote:

In one case, only one directory changes its contents, in the other, either directory could be modified.

How often does sync'ing need to happen?  If it's once a day (or even hourly) place the following code in, say, /etc/cron.daily/sync.cron:

#/bin/bash
rsync -az -e ssh /source/directory root@otherhost:/destination/

Then, setup ssh keys so no password is required for root, from the source host to the destination host ('man ssh').

That would take care of the first case.  For the bi-directional case, there is a -u (--update) option in rsync that may help.  (Setup a similar cron job and ssh keys in the other direction.)

However, would an NFS or Samba share work for your situation? (i.e. not needing to sync over the Internet).  If you setup NFT or Samba, both hosts could use the filesystem and sync'ing would be taken care of.  You could still rsync the share contents to the client host, as a nightly backup, using rsync.

Offline

#5 2005-03-14 17:18:06

lucke
Member
From: Poland
Registered: 2004-11-30
Posts: 4,018

Re: Directory syncing

There's also dirsync - but it seems it works only locally, so it'd come handy for you only if you were using NFS/Samba mounts.

Offline

Board footer

Powered by FluxBB