janeczku / calibre-web

:books: Web app for browsing, reading and downloading eBooks stored in a Calibre database
GNU General Public License v3.0
13.13k stars 1.4k forks source link

Reconnect to calibre database on SIGHUP #3214

Closed quantum5 closed 1 week ago

quantum5 commented 2 weeks ago

This PR hooks the "Reconnect Calibre Database" feature in the admin page to SIGHUP. This allows the database to be reloaded by running a command, which is extremely useful when using synchronization tools with the calibre metadata.db.

For example, Syncthing would delete metadata.db and recreate a new file in its place when the database is modified on a different machine, and inotifywait can be used to send SIGHUP when this happens.

OzzieIsaacs commented 1 week ago

I'm not a fan of coping/recreating/moving the metadata.db file while calibre-web is running. So I will not implement anything to make this easier. You could write a bash script with inotifywait and trigger the /reconnect route of calibre-web (https://github.com/janeczku/calibre-web/wiki/Command-Line-Interface#command-line-options, the -r option)