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.

(xor-gate) #3

I have also synced my Calibre library including the sqlite index database. As @calmh suggests, don’t open it one multiple computers at once. Sqlite databases are not designed for this. This can now be a problem because “it is made possible” to use it on “two machines at the same time” which can corrupt or conflict the synchronisation.

Hope this is clear!



Sorry if I hijack the discution but I think we might be looking for the same solution.

My problem is related as I have issues with Syncthing/Calibre (and Calibre is not open on second PC).

Do you know any program that could behave like this : IF program.exe active THEN syncthing-pause

When I use Calibre, a lot of files are modified in its Library folder. It looks like there’s no issue at first. But when I go in the library folder, I find some CONFLICTS folders. It’s like there’s too many updates of the library folder during Syncthing sync and then it thinks that the backup is the latest update and syncback “old” files.

I’m not sure if I’m clear… So just in case : It’s almost like FILE is updated 4 or 5 times by Calibre during Syncthing sync that is still sending update 3 and then thinks that update 3 is the latest and sync back / override update 5 resulting in a conflict.

That’s the only program I have issues with for now and I use Syncthing since a year.

(xor-gate) #5

It is possible Calibre does weird stuff, I have one true origin of my library on my iMac desktop and set it to Send Only mode. Which pushes it to my backup machines using syncthing. I’m not syncing between two machines with Send & Receive folder type. So my case is different than yours which can result in conflicts.

What you could do is set disable the Watch for changes (share -> edit -> advanced -> scanning, and set the rescan interval something like 5 minutes or so). This will not totally prevent your conflict but reduces the file/folder change notifications from the filesystem being distributed back and fort.

Let me know if it helps @secretliar!

(system) closed #6

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.