16

I'm looking for a way to keep a desktop and a laptop in sync. Something that I want to keep in sync are Gnote notes.

If it matters I can connect to my desktop from anywhere via an URL but my laptop is harder to access since it might be behind NAT and such.

Braiam
  • 67,791
  • 32
  • 179
  • 269
N.N.
  • 18,219

6 Answers6

10

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

fossfreedom
  • 172,746
  • How would that work if one computer happens to be behind NAT? – N.N. Jul 07 '11 at 23:01
  • Appreciate your update. Your guide on Dropbox will work as well with Ubuntu One, right? – N.N. Jul 08 '11 at 17:58
  • 1
    Have you actually tried putting notes in dropbox? The Tomboy (I know, not gnote) developers specifically warn against doing this as it may corrupt notes. I have had first hand experience of this happening. – popey Jul 08 '11 at 18:01
  • 1
    Yeah this won't work, the app needs to separate the data from the machine specific bits or it will mangle it, which is why Tomboy has the "file sync" option that lets you sync a folder in this manner. – Jorge Castro Jul 08 '11 at 18:03
  • @popey - yes - i've been playing with the latest version of dropbox when doing this - it works very well. If you are not convinced - you can always pause dropbox. When you've finished and closed gnote you can unpause dropbox to sync the files. – fossfreedom Jul 08 '11 at 18:04
  • jorge - I will continue testing with making big changes - I'll report back if I notice any file corruptions – fossfreedom Jul 08 '11 at 18:05
  • I would welcome any feedback on file corruptions - I cannot get it to corrupt. Maybe because there isnt any central database to sync and maybe because each note is an individual file. – fossfreedom Jul 08 '11 at 19:17
  • My corruption issues occurred when there were multiple machines accessing the notes in the dropbox folder. Many conflicts would occurr whenever syncing. I'd strongly recommend not doing this. – popey Jul 13 '11 at 11:28
  • Could you please link the bug? – N.N. Jul 13 '11 at 17:59
  • @fossfreedom I decided to use the command-line version of Unison. Also I noticed that you should keep Gnote closed on both computers when syncing for it to work properly. – N.N. Jul 13 '11 at 19:53
5

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.

  • 1
    I went from Tomboy to Gnote because of Gnote being faster, so I'm afraid that this is of no help to me. – N.N. Jun 29 '11 at 13:29
5

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://user@user.dyndns-ip.com//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.

N.N.
  • 18,219
1

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?

Ralf Hersel
  • 2,793
  • fossfreedom initially suggested using dropbox but deleted it due to fear of file corruption. See the comments and earlier revisions of fossfreedom's answer. – N.N. Feb 08 '12 at 15:57
1

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.

BuZZ-dEE
  • 14,223
Jon
  • 11
  • 1
0

Get a SpiderOak account. They have a zero-knowledge privacy policy: everything is client-side encrypted, unlike other services. Also, you don't have to mess around with the command line - it's quite user-friendly.

Either enable backup and syncing on the data folder (or folders) you care about, or put the data directories in an already-backup-and-synced folder, and they symlink to them.

colan
  • 1,155
  • Have you tested so that this work with SpiderOak? How does it differ from Ubuntu One which is already integrated with Ubuntu? It seems similar to Dropbox which was warned against in http://askubuntu.com/questions/51095/sync-gnote-notes/124048#comment59163_52241 – N.N. Apr 21 '12 at 23:13
  • Sorry, I haven't tested it with this app, but I use SpiderOak for other stuff. For notes, I gave up on Ubuntu desktop apps as none of them sync with Memotoo, where they are now.

    I was using Tomboy + Ubuntu One, but Ubuntu One stopped offering a web interface (unlike Memotoo), and the client on my laptop stopped working (even after following https://one.ubuntu.com/help/faq/how-do-i-completely-remove-and-reinstall-ubuntu-one/).

    SpiderOak advantages are (1) encryption, (2) automatic file versioning, and (3) reliability (in my honest opinion).

    – colan Apr 23 '12 at 00:55
  • Ok, your answer would be better if you include a step by step description on how to implement it. – N.N. Apr 23 '12 at 06:17