Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Calibre

Notices

Reply
 
Thread Tools Search this Thread
Old 11-17-2018, 01:32 PM   #1
wjwieland
Junior Member
wjwieland began at the beginning.
 
Posts: 3
Karma: 10
Join Date: Nov 2018
Device: Galaxy Tab 4
Calibre and NextCloud (Owncloud)

Scenario:
I run Nextcloud on my server at home. My Calibre library resides on the server. I run the Calibre application on my laptop as well as the Nextcloud sync client and keep my local library synced to the server which is backed up twice a day.

To Remember:
If one keeps the Calibre library locally on ones synced laptop ( as I do ), and runs a sync client, it is important that one shut down the Nextcloud client prior to starting up the Calibre application.

Cause:
The nextcloud client notices any changes on synced file system and immediately syncs them back to the server. This puts a lock on whatever file is being modified (the sqlite db of Calibre for example), leaving the Calibre application without access to those file, thus generating an error. (Unable to write to the database).

PS:
Just a heads up in case it has not been noticed previously.... or for someone who has not found this in some other post.
Hope someone finds it helpful....
wjwieland is offline   Reply With Quote
Old 11-17-2018, 02:23 PM   #2
haertig
Evangelist
haertig ought to be getting tired of karma fortunes by now.haertig ought to be getting tired of karma fortunes by now.haertig ought to be getting tired of karma fortunes by now.haertig ought to be getting tired of karma fortunes by now.haertig ought to be getting tired of karma fortunes by now.haertig ought to be getting tired of karma fortunes by now.haertig ought to be getting tired of karma fortunes by now.haertig ought to be getting tired of karma fortunes by now.haertig ought to be getting tired of karma fortunes by now.haertig ought to be getting tired of karma fortunes by now.haertig ought to be getting tired of karma fortunes by now.
 
Posts: 420
Karma: 2586988
Join Date: Sep 2017
Device: PaperWhite 3, Fire HD8 Gen7, Sansa Clip v2 Rockbox (audiobooks)
I run Nextcloud too, but don't use it to sync my Calibre library. I use systemd/rsync to "pull" the Calibre library to the client instead.

In my case, the client mentioned here is actually a computer that functions as my media server. This computer runs Nextcloud, Docker, Calibre-web (an alternate to the built-in Calibre server) and several other things. So this system is a client in regards to my primary Calibre library, but it serves the data it pulls from my primary Calibre library.

Confusing terminology, I know! This is what I run on this client:

Code:
calibre@linux-server-1 ~/.config/systemd/user $ cat rsync_calibre.service
[Unit]
Description=Rsync Calibre books from 10.192.0.2 to /var/opt/calibre/

[Service]
Type=simple
ExecStart=/home/calibre/bin/rsync_calibre_books.sh

[Install]
WantedBy=default.target

calibre@linux-server-1 ~/.config/systemd/user $ cat rsync_calibre.timer
[Unit]
Description=Timer to Rsync Calibre books from 10.192.0.2
RefuseManualStart=no
RefuseManualStop=no

[Timer]
Persistent=true
OnBootSec=120
OnCalendar=daily
Unit=rsync_calibre.service

[Install]
WantedBy=timers.target

calibre@linux-server-1 ~/.config/systemd/user $ cat /home/calibre/bin/rsync_calibre_books.sh
#!/bin/bash

/usr/bin/rsync -avzh --password-file=/home/calibre/bin/rsync.calibre.credentials rsync://calibre@10.192.0.2:873/files/ /var/opt/calibre/
/bin/sleep 5
/usr/bin/rsync -avzh --password-file=/home/calibre/bin/rsync.calibre.credentials rsync://calibre@10.192.0.2:873/config/ /home/calibre/.config/calibre/
/bin/sleep 5
/usr/bin/docker container restart calibre-web

calibre@linux-server-1 ~/.config/systemd/user $
Above, I restart the Docker container that is running calibre-web so that it picks up the changes that came across via the rsync. The Calibre library that is rsynced is mounted external to the Docker container (I use a Docker bind mount rather than a volume).

I am running an rsync daemon on the server that the above client pulls the Calibre library from. This server is actually my desktop system, and is where I keep my primary Calibre library for my personal use. Here is what I run on this server (and it is a server only in regards to hosting my primary Calibre library):

Code:
root@Linux-Desktop /etc/systemd/system $ cat rsyncd@.service
[Unit]
Description=RSYNC Per-Connection Server
After=network.target

[Service]
ExecStart=/usr/bin/rsync --daemon
StandardInput=socket

root@Linux-Desktop /etc $ cat rsyncd.conf
pid file = /var/run/rsyncd.pid
lock file = /var/run/rsync.lock
log file = /var/log/rsync.log

[files]
path = /media/Digitalbooks
comment = CALIBRE EBOOKS
timeout = 600
read only = true
hosts allow = 10.192.0.27, 10.192.0.21
auth users =  calibre
secrets file = /etc/rsyncd.secrets

[config]
path = /home/calibre/.config/calibre
comment = CALIBRE CONFIG
timeout = 600
read only = true
hosts allow = 10.192.0.27, 10.192.0.21
auth users =  calibre
secrets file = /etc/rsyncd.secrets

root@Linux-Desktop /etc $
p.s. - It is not necessary to rsync across the Calibre config directory the way I am using this (with the alternate calibre-web server). Rsync-ing that is a left-over from when I was running the built-in Calibre server before. Over time, I realized that it was a bit wasteful of resources to run a full Calibre instance just to serve up the files, so I switched to calibre-web instead. So rsync-ing the Calibre config stuff is no longer needed, and I just realized that I was still doing it when I posted my stuff above. Doesn't really hurt anything to unnecessarily rsync this stuff though. It's a small amount of data, rarely changes, so the rsync is nearly instantaneous.

Last edited by haertig; 11-17-2018 at 02:29 PM.
haertig is offline   Reply With Quote
Old 11-27-2018, 09:52 PM   #3
wjwieland
Junior Member
wjwieland began at the beginning.
 
Posts: 3
Karma: 10
Join Date: Nov 2018
Device: Galaxy Tab 4
Thanks much Haertig!
A well thought out solution which I will have to consider. I appreciate the detail you provided in you response. I think that might work for me and my setup...

Thanks again for taking the time!
wjwieland is offline   Reply With Quote
Old 11-30-2018, 01:31 PM   #4
haertig
Evangelist
haertig ought to be getting tired of karma fortunes by now.haertig ought to be getting tired of karma fortunes by now.haertig ought to be getting tired of karma fortunes by now.haertig ought to be getting tired of karma fortunes by now.haertig ought to be getting tired of karma fortunes by now.haertig ought to be getting tired of karma fortunes by now.haertig ought to be getting tired of karma fortunes by now.haertig ought to be getting tired of karma fortunes by now.haertig ought to be getting tired of karma fortunes by now.haertig ought to be getting tired of karma fortunes by now.haertig ought to be getting tired of karma fortunes by now.
 
Posts: 420
Karma: 2586988
Join Date: Sep 2017
Device: PaperWhite 3, Fire HD8 Gen7, Sansa Clip v2 Rockbox (audiobooks)
If you are interested in mostly just backing up your Calibre library as opposed to serving it to other clients, you might want to investigate the "UrBackup" program. Free, open source. Basically you run a UrBackup server that is the central repository for all your backups. Then you run a UrBackup client on each computer that you want to backup (Linux, Windows, Mac - clients available for all of them).

https://www.urbackup.org/

UrBackup does not take much horsepower to run. As a matter of fact, my UrBackup server is a lowly Raspberry Pi 3 with an external 4Tb WD red drive. This Raspberry Pi backs up 6 computers currently (three Linux and three Windows, and one of those is remote in a different town). I chose a Pi with external hard disk for the server because it is portable. I can deploy it at a friends or family's house and thus I have a remote backup (in case my own house burns down, taking my local computer backups with it). UrBackup does a wonderful job of rolling over older backups. You configure how long to keep backups, how many to keep, how frequently to do them, whether they are file backups or image backups, etc.

UrBackup provides a nice web interface for control and configuration.
Screenshots here: https://www.urbackup.org/impressions.html
haertig is offline   Reply With Quote
Old 12-07-2018, 02:06 AM   #5
wjwieland
Junior Member
wjwieland began at the beginning.
 
Posts: 3
Karma: 10
Join Date: Nov 2018
Device: Galaxy Tab 4
http://storebackup.org/ is what I use currently. It looks like both are pretty capable and I will certainly check out your solution as well. Thank you.
wjwieland is offline   Reply With Quote
Reply

Tags
error, nextcloud, sync client

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Support for cloud services (Dropbox/Nextcloud) fsantini Kobo Developer's Corner 15 12-03-2018 06:45 AM
Does CC work with Nextcloud? gla Calibre Companion 1 05-30-2018 03:07 PM
Management through NextCloud ?? vincegre Library Management 8 07-20-2017 08:20 AM
Temporary files and Owncloud apastuszak Calibre 3 05-08-2014 07:25 PM
Pocketbook & Cloud (Dropbox, owncloud) Partycrash00 PocketBook 4 03-18-2014 01:27 PM


All times are GMT -4. The time now is 04:28 PM.


MobileRead.com is a privately owned, operated and funded community.