I am trying to get Calibre server to start automatic during startup. I have used this tutorial. Then I've used this script:
[Unit]
Description=Calibre Service
After=network.target
[Service]
User=calibre
Group=calibre
ExecStart=/usr/bin/calibre-server \ --daemonize \ --max-cover=600x800 \ --max-opds-items=30 \ --max-opds-ungrouped-items=100 \ --username=calibre \ --port=9000 \ --pidfile=/var/run/calibre-server.pid \ --with-library=/jan/home/calibre-library/
[Install]
WantedBy=multi-user.target to create an auto startup in systemd. If I manualy startup with: systemctl start calibre.service It seems to execute. If I give the command: systemctl status calibre.service, I get the following result:
● calibre.service - Calibre Service Loaded: loaded (/lib/systemd/system/calibre.service; enabled; vendor preset: enabled) Active: inactive (dead) since Thu 2017-05-25 21:55:51 CEST; 45s ago Process: 1887 ExecStart=/usr/bin/calibre-server --daemonize --max-cover=600x800 --max-opds-items=30 --max-opds-ungrouped-items=100 --username=calibre --port= Main PID: 1887 (code=exited, status=0/SUCCESS)
May 25 21:55:50 FileServer systemd[1]: Started Calibre Service.
May 25 21:55:50 FileServer calibre-server[1887]: No write acces to /home/calibre/.config/calibre using a temporary dir instead
But when I look in my browser there is no calibre home page on , this is my home server. Does anyone have a clue?
12 Answers
You are using --pidfile=/var/run/calibre-server.pid which tell calibre to write the pid file to /var/run. Most likely the user running the process User=calibre does not have access to write there. I'd suggest you remove --pidfile since you're not using it.
If you do want to use it, change the path to a writeable directory by the calibre user and add PIDFile=/dir/with/pidfile/calibre-server.pid before your ExecStart line, and as mentioned above also add Type=forking
I am running a Calibre server successfully on 18.04, so hopefully these suggestions apply to your distribution as well.
I would change the Type to "oneshot" and remove the "--daemonize" tag because it doesn't need to be there since you're running it from systemd anyway. If you are running the current version of calibre then you need to remove the "--with-library" tag and just leave the last line as "/path/to/calibre/library".
Additionally, you specify a username but no password. Not sure if that causes problems, but it might be better to create a user database and then pass the option "--enable-auth" to your server command to activate your users (see the calibre user manual) along with "--userdb /path/to/users.sqlite". If you need more information on how to do this I can expand.
Lastly, since it hasn't been mentioned yet, please make sure the port you are using is allowed through your firewall and forwarded by your router properly.