Mirror local folder with ssh

Hi, I’d like to mirror a local folder with an dreamhost ssh accounts folder. Unison was my choice and obviously it would have worked nicely if it was installed on dreamhosts server. Is there a way to install this on my own account?
Or do you have a better solution for syncing?

You might want to check our rsync. I know others use that with dreamhost. I believe you should find more info about that in the wiki.

In many cases you can install things your self on your server. Make sure it’s not a persistant process, meaning that it runs all the time regardless if you’re hooked up to it or not. You’ll ssh into your accout and you can compile there. You’ll have to make sure it’s going to put the files in your home directory.

art.googlies.net - personal website

Unfortunately I have no idea how to compile unison to my dreamhost homedirectory. Maybe you could give me a hint. (http://www.cis.upenn.edu/~bcpierce/unison/)

I tried rsync, but I need bidirectional syncing and that is impossible with rsync, at least as far as I know…

well, I looked over the documentation… Man do they need someone to rewirte that. It’s all convoluted and out of order, telling you how to do things before you know what you need to do.

Anyways, from what I can tell you need to end up with unison installed on both your computer and on your server at dreamhost. I think that following the unix install directions will work. (though it’s actaully linux running here on dreamhost). GNU is installed already on your server, but you’ll have to install “OCaml” and then unison. As you’re going along follow the install instructions for these programs I believe you’ll see instructions to:
make install

Or something along those lines. You’ll need to add to the ./configure command to tell it where to install. It then would go soomething like:
./configure --prefix=$HOME/username/path

You’ll want to use the “Remote shell method” to connect up to the ‘remote machine’.

That’s the idea anyways. I don’t have time to really make a more detailed set of instructions, but I’m happy to help out along the way. However, it seems like an awful lot of trouble to me - I’d think you could find a better easier solution that all of this work.

EDIT: Oh yeah. If you don’t know already, you’ll be using an ssh connection to carry out these commands and install the software. Check out the SSH wiki article to get that going.

art.googlies.net - personal website

Thanks for that help Matt. Unfortunately the OCaml site is down and the unison tar doesn’t contain a configure.
I think I will look for a different syncing solution.

I found the instructions above a bit vague so here is exactly what I did to make it work(this assumes you have downloaded ocaml and unison and untard them in your home directory somewhere temporaily, they will be deleted when you are done.)


./configure -prefix $HOME/sw && make world && make bootstrap && make opt && make install

adjust path to include /sw/bin


edit Makefile
line 71:
INSTALLDIR = $(HOME)/sw/bin/

make install

there you have it unison is now installed in $(HOME)/sw/bin at this point delete the tarballs and the temporary directories that you compiled ocaml and unison in.

I just downloaded the pre-compiled Linux version; it works fine on DH machines.

OK, so I’m having a bit of trouble making this whole Unison thing work – and I really want it to work, because it’s exactly what I need. Here’s what I did, in a nutshell:

Download latest GUI version, v. 2.27.47, of Unison for my computer (Mac, running OS 10.4.10)
Download, untar, compile OCaml on Dreamhost
Download, untar, compile Unison, move into ~/bin/ (making sure that it is the same version, 2.27.47, that I have on my desktop)
Modify PATH to include ~/bin

So far so good; when I ssh in to dreamhost and type “unison” at the prompt, I get

Usage: unison [options]
or unison root1 root2 [options]
or unison profilename [options] (etc.)

Then the ugly starts. I run Unison on my machine, and it says the connection is dropped. When I install the command-line tool and watch carefully, I see this:

[wfc:~] tcsh% unison /Users/myname/documents/sync-test/ ssh://me@myserver.com//home/myname/testdir/
2007-10-27 18:03:58.122 Unison[15962] Connecting…
2007-10-27 18:03:59.685 Unison[15962] Got the prompt: 'Password: ’

[The GUI version appears and prompts me, and I enter the password here]

bash: line 1: unison: command not found
2007-10-27 18:04:05.054 Unison[15962] Uncaught exception: Fatal error: Lost connection with the server
[wfc:~] tcsh%

Okay, so it doesn’t know where the remote version of Unison is, even though it’s in the path… we can work on that, but for the time being let’s just tell it:

[wfc:~] tcsh% unison /Users/myname/documents/sync-test/ ssh://me@myserver.com//home/myname/testdir/ -servercmd /home/myname/bin/unison
2007-10-27 18:06:27.262 Unison[16131] Connecting…
2007-10-27 18:06:28.724 Unison[16131] Got the prompt: 'Password: '
2007-10-27 18:06:34.353 Unison[16131] Connected.

Woo hoo! The GUI window expands the way it’s supposed to and I get a list of files to sync. All of them are correct, so I click on Synchronize and it starts chugging away. Once it’s down to the last file (a big .mp3), it chews on it for a bit and then crashes, reporting the following:

2007-10-27 18:07:30.044 Unison[16131] Uncaught exception: Unix error(Resource temporarily unavailable,write,)
Killed by signal 1.
[wfc:~] tcsh%

So, my big questions:

  1. Any way to have Unison know when it signs in where it can find the server version of the program? (I put the path mod into my .bash init file, and it works when I ssh in, but for some reason Unison isn’t finding its twin.)

  2. Any idea what’s going on with this nasty write error that I get with larger files?


aargh, okay, I just answered the first question for myself: put

export PATH

in your .bashrc. The second one, however, remains a problem.