Using Syncthing with Calibre safely

(Ckp95) #1

I want to use Syncthing to synchronise my Calibre library across two devices (desktop and laptop, both running Linux). I pointed Syncthing at my Calibre directories and so far it seems to work: changes made to the database on one device get propagated to the other. However, I’m a bit spooked by the warnings made in the Calibre documentation:

If you must share the actual library, use a file syncing tool like DropBox or rsync instead of a networked drive. If you are using a file-syncing tool it is essential that you make sure that both calibre and the file syncing tool do not try to access the calibre library at the same time. In other words, do not run the file syncing tool and calibre at the same time.

So this is what I’ve been doing:

  • make sure desktop does not have Syncthing running
  • use Calibre on desktop, make changes (add PDFs, edit metadata, etc)
  • close Calibre
  • run Syncthing on desktop and allow the changes to propagate to laptop
  • close Syncthing on laptop
  • open Calibre on laptop
  • etc

While this works, it’s pretty cumbersome, and not practical because sooner or later I’m going to forget and end up with Calibre and Syncthing running at the same time, and potentially corrupt the Calibre database.

Is there a way to tell Syncthing to automatically check whether Calibre is open, and if so, not to do any syncing? This could also be some kind of external shell script.

(Jakob Borg) #2

“access” here should be interpreted as “modify”. In effect this means make sure Syncthing is up to date when you start Calibre (as far as the Calibre library is concerned), and don’t run Calibre on more than one synced computer at the same time.