Having agreed with my manager, who was kind enough to allow me to work from home while away in India (my home country), I was quite eggsited about the Easter break. As usual, I was visiting my family, and was hopeful that it will workout OK for me, but it turns out that the country seem to develop backwards!
Surely, what is said in the title is normally not very relevant to most people in developed world, but this would work equally for anyone who need to develop in an environment where source edits happen on one machine (laptop, desktop, tablet, etc) and the updated files need to be copied to another host for it be compiled or run (in webserver, for example).
lsyncd came to my rescue! For a basic overview, click here. The command that I ended up formulating is as below. The utility is available as a package in Linux Mint (ditching Ubuntu for now, till Mr Shuttleworth makes up his mind; not his guinea pig).
lsyncd -nodaemon -log Exec -rsyncssh $HOME/devhost_backup/ svn_root/trunk devhost.mycompany.com $HOME/svn_root/ trunk
Here, I have a backup of my usual SVN checkout under the path $HOME/devhost_backup. When ever I change anything within that folder, lsyncd monitors these via inotify and the changes aggregated over a few seconds' period, and are replicated using rsync. File operations that are normally done better via shell commands are run over an SSH session. (Here it is assumed that the username is the same on both hosts, and you have a key-based SSH access setup and working.)
IMO, this is the best combo inotify + rsync + SSH (for moves, deletes, etc). Seems to work a treat!
Basically the ISP in my town here is quite appalling! A strong
breeze and the connection is gone! Summer rains which is usually associated with thunders, makes it worse! Power-cuts or load shedding as they call it, is cherry on the
cake! So I am left with a home setup that has a few KVA backup power
but no reliable Internet connection! So I am having to work offline
mostly and then sync occasionally!
Some people might think, why not use a remote filesystem like SSHFS (fuse mount
over SSH); I could, if the connection was stable, it is a no go area on unreliable link, as the
mount hangs when link goes away!
Surely, what is said in the title is normally not very relevant to most people in developed world, but this would work equally for anyone who need to develop in an environment where source edits happen on one machine (laptop, desktop, tablet, etc) and the updated files need to be copied to another host for it be compiled or run (in webserver, for example).
lsyncd came to my rescue! For a basic overview, click here. The command that I ended up formulating is as below. The utility is available as a package in Linux Mint (ditching Ubuntu for now, till Mr Shuttleworth makes up his mind; not his guinea pig).
lsyncd -nodaemon -log Exec -rsyncssh $HOME/devhost_backup/
Here, I have a backup of my usual SVN checkout under the path $HOME/devhost_backup. When ever I change anything within that folder, lsyncd monitors these via inotify and the changes aggregated over a few seconds' period, and are replicated using rsync. File operations that are normally done better via shell commands are run over an SSH session. (Here it is assumed that the username is the same on both hosts, and you have a key-based SSH access setup and working.)
IMO, this is the best combo inotify + rsync + SSH (for moves, deletes, etc). Seems to work a treat!
Comments
Post a Comment