You are not logged in.

#1 2009-01-12 16:27:56

Tido
Member
Registered: 2007-06-21
Posts: 65

"Live" Rsync

I'm working in one location and use rsync to send my code to a development server here at work.  Currently I make my changes and run rsync manually with something like:

rsync -zrptLv --delete-after -e "ssh" --exclude=.svn /home/code/ devserver:/code/

And that works great, except it's annoying to always have to run that line whenever I change a file.  Does anyone know a way to monitor a directory (recursively) for file changes and run rsync when it happens?

Offline

#2 2009-01-12 16:42:38

marxav
Member
From: Gatineau, PQ, Canada
Registered: 2006-09-24
Posts: 386

Re: "Live" Rsync

something like this maybe pyinotify...

Offline

#3 2009-01-12 19:16:57

jcolinzheng
Member
From: Cambridge, MA
Registered: 2008-08-06
Posts: 50
Website

Re: "Live" Rsync

Either sshfs, or some inotify daemon will do - such as incron (http://inotify.aiken.cz)

Offline

#4 2009-01-12 19:54:32

Zariel
Member
Registered: 2008-10-07
Posts: 446

Re: "Live" Rsync

or git ? tongue

Offline

#5 2009-01-12 20:03:04

rson451
Member
From: Annapolis, MD USA
Registered: 2007-04-15
Posts: 1,233
Website

Re: "Live" Rsync

Zariel wrote:

or git ? tongue

+1, sort of.  I'm not familiar with git, but with svn he would still have to run at least a svn commit after a change.  Version control just makes sense though.


archlinux - please read this and this — twice — then ask questions.
--
http://rsontech.net | http://github.com/rson

Offline

#6 2009-01-12 21:13:49

Tido
Member
Registered: 2007-06-21
Posts: 65

Re: "Live" Rsync

Gah, incron looked so promising until I fiddled with it for an hour only to discover it doesn't scan subdirectories recursively.  That's a show-stopper sad.

Offline

#7 2009-01-12 23:08:35

jcolinzheng
Member
From: Cambridge, MA
Registered: 2008-08-06
Posts: 50
Website

Re: "Live" Rsync

Tido wrote:

Gah, incron looked so promising until I fiddled with it for an hour only to discover it doesn't scan subdirectories recursively.  That's a show-stopper sad.

Oops...Indeed incron can't monitor a whole directory tree.  You could try fsniper (http://projects.l3ib.org/trac/fsniper); claimed to be able to do that.

Offline

#8 2009-01-13 12:04:58

jelly
Administrator
From: /dev/null
Registered: 2008-06-10
Posts: 714

Re: "Live" Rsync

You can use dropbox, it while sync a two pc's. I use it for my work on the university, there i work on a laptop but at home i rather work on my Desktop. So i use dropbox , it's a 2 gb webspace and it also handles subdirectories. There's a wiki about it.;)

Offline

#9 2009-01-13 16:14:09

Tido
Member
Registered: 2007-06-21
Posts: 65

Re: "Live" Rsync

I can't do dropbox. Our firewall restrictions would prevent that.

Offline

#10 2009-01-13 22:49:47

marxav
Member
From: Gatineau, PQ, Canada
Registered: 2006-09-24
Posts: 386

Re: "Live" Rsync

install inotify-tools from the AUR.
Create a script:

#!/bin/sh
while inotifywait -e modify -e create -e delete /home/code/; do
     rsync -zrptLv --delete-after -e "ssh" --exclude=.svn /home/code/ devserver:/code/
done

Run it!

Offline

#11 2009-01-14 13:09:29

bluewind
Administrator
From: Austria
Registered: 2008-07-13
Posts: 172
Website

Re: "Live" Rsync

fnsiper works for subdirs and it's damn easy to use. Thanks jcolinzheng. I've also been searching something like this and I always used icrond, which has some strange issues when running commands.

Last edited by bluewind (2009-01-14 13:10:32)

Offline

#12 2009-03-26 18:05:10

palobo
Member
From: Leiria, Portugal
Registered: 2009-03-21
Posts: 68

Re: "Live" Rsync

Hey guys.

Personally I haven't tried this but have heard good things. iFolder

Hope it helps.

CHeers,
P.


" If it aint broke... Then you're not trying hard enough! "

Offline

Board footer

Powered by FluxBB