Это старая версия документа.

Данная программа позволяет средствами rsync делать резервное копирование сразу же по появлению нового файла в указанной директории (а-ля Dropbox)

FIXME One-way, realtime sync using Lsyncd (http://lsyncd.googlecode.com)

Lsyncd watches a local directory trees event monitor interface (inotify). It aggregates and combines events for a few seconds and then spawns one (or more) process(es) to synchronize the changes. By default, rsync is used. Lsyncd is thus a light-weight live mirror solution that is comparatively easy to install not requiring new filesystems or blockdevices and does not hamper local filesystem performance. Below, I am syncing data from my Mint 12/Ubuntu hybrid client PC to a Synology DS211J NAS.


Установка зависимостей:

apt-get install rsync libxml2-dev build-essential lua5.1 liblua5.1-dev

Установка lsync

 wget https://lsyncd.googlecode.com/files/lsyncd-2.1.5.tar.gz
tar xvf lsyncd-2.1.5.tar.gz
cd lsyncd-2.1.5
sudo checkinstall


Содержимое ~/.lsyncd/lsyncd.config

settings = {
   logfile  	= "/home/mint/.lsyncd/lsyncd.log",
   statusFile   = "/home/mint/.lsyncd/lsyncd.status",
   nodaemon 	= false,
   maxDelays	= 900,
   maxProcesses = 6,

sync{default.rsyncssh, source="/media/sdc1/DataFiles", host="root@", targetdir="/volume1/lsyncd", rsyncOpts="-a"}

Сохраните файл

4. Before performing the sync test, make sure you have a passwordless ssh session to the host identified in the lsyncd.config file. If not, follow these steps:

On your Desktop/client: $> ssh-keygen -N '' -f ~/.ssh/id_dsa On paraphrase prompt, just press ENTER, then the following (note: REMOTE_SERVER is the ssh server host, in this case my DS211J NAS) $> cat ~/.ssh/id_rsa.pub | ssh 'cat - » ~/.ssh/authorized_keys2' $> ssh 'chmod 700 .ssh' Then test it using the terminal (it should log you into the remote server. $> ssh

5. When all are successfully done, create your preferred name for the NAS sync folder, mine.. I just called it “lsyncd”. It should have the path as follows: /home/username/lsyncd (or server.mydomain.local:~/lsyncd if syncing across the internet)

6. All are set and ready to go, test the lsyncd from your desktop. $> lsyncd -nodaemon ~/.lsycnd/lsycnd.config

7. Populate the local folder and watch the remote ssh server for changes.

8. Create the following following entry in your StartUp Applications app:

   lsyncd ~/.lsycnd/lsycnd.config

9. Done.

Files updated on your desktop will One-way sync to your NAS. I like this better than 2-way sync because of a bad DropBox experience I had where I almost lost everything due to a syncing glitch (an offline PC that had my files saved me).

By the way, make sure nautilus is installed. It contains packages that this process needs.