How can I sync Gnote notes?

Solution 1:

Gnote holds its notes in the folder ~/.local/share/gnote

Therefore you could use something like Unison (install unison-gtk from software centre) to sync the gnote folder between the two computers if they are on the same network.

Unison

Since you are behind a NAT then you can use the concept of reverse ssh connections - rather than duplicate, there is an excellent step-by-step in this AU question and answer. However during my testing, I found that the version of unison in Natty doesnt work with the openssh version in Natty.

So here is a guide to get Unison to work.

On each PC you'll need to install openssh-server to enable you to ssh between each PC at any one time together with unison

sudo apt-get install openssh-server unison unison-gtk

Now open your browser and download the Debian version of unison-gtk - i386 for 32bit and amd64 for 64bit Natty and install it N.B. the version in Natty has a serious SSH bug and does not work.

cd Downloads
sudo dpkg -i unison-gtk_2.32.52-3+b1_i386.deb

Follow the openssh-server guide above to setup a SSH link between your two computers. Test the link both ways to confirm you can see both computers home directory.

i.e. from desktop pc to NAT pc

ssh -p 6222 localhost

and from NAT pc to desktop pc

ssh username@desktoppc

Now configure a unison configuration on your desktop pc

unison-gtk &

enter the FULL path to your gnote folder as per this picture

enter image description here

Now enter both the NAT pc gnote folder and the socket number 62222

enter image description here

Then click the SSH radiobutton and enter the host name localhost

enter image description here

You will now be able to sync folders either manually or automatically.

To do the same from the NAT pc start unison-gtk, configure the local gnote folder as above, and the desktop pc folder as per this picture

enter image description here

Solution 2:

While this doesn't directly answer your question, you might want to check out Tomboy as a note taking application. One of its features is the ability to synchronise its set of notes via various back ends.

One of the synchronisation options is to synchronise via an Ubuntu One account, which would provide the required functionality without having to set up any special server software.

If you would prefer to use a server under your own control, you could set up an instance of Snowy, which uses the same protocol as the Ubuntu One sync option. Alternatively, if you can access a server via ssh, Tomboy can use that via the SSH Sync Service Add-in.

Solution 3:

This is a solution based on fossfreedom's answer, Synchronizing 2 Ubuntu Systems with Unison and the Unison manual. The differences are that I instead of using a GUI for Unison use the command-line version and that I instead of trying to tunnel past NAT always execute the sync command from the computer that might behind NAT.

Setup

Both computers

  1. sudo apt-get install openssh-server unison
  2. Test the SSH link from each computer to the other.

On the computer that might be behind NAT

  1. mkdir ~/.unison
  2. nano default.prf – Create a profile file named default.
  3. Write the profile file, e.g.:

    root = /home/user
    
    root = ssh://[email protected]//home/user
    
    path = .local/share/gnote
    

Sync

Sync the computers by running unison -auto default on the computer that might be behind NAT. This will sync notes and it will ask the user what to do if there is conflicts. Note that you should close Gnote on both computers before syncing. I do this before and after my laptop leaves the LAN with my desktop to keep their notes in sync.

Solution 4:

Syncing the Gnote folder between several computers works perfectly with Ubuntu One. See this question for more details: How to access a synced folder from another PC?

Solution 5:

Its probably not what you're looking for, but I did this manually (Gnote is awesome, no more, no less).

(On laptop) I use Wicd's postconnect script-function to scan the network. If it finds my home network, it connects sshfs local (192.168.0.12) and mount the folder on the homeserver with the gnote-files at ~/.local/share/gnote-folder, else it grabs the home-ip from my webhost, which is always updated from the homeserver (no static ip from ISP). My desktop has the gnote-folder in fstab, if I remember it right.

Works like a charm, but I never open Gnote without network, and are not using Gnote on my desktop and laptop at the same time.