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.