User:Simon/Trim4/prototypes/calibre service file: Difference between revisions

From XPUB & Lens-Based wiki
No edit summary
No edit summary
Line 20: Line 20:
Now run:
Now run:


note to self: is the program called <code>calibre</code> or <code>calibre-server</code>?
<code>sudo systemctl start calibre</code>
<code>sudo systemctl start calibre-server</code>


to start the server. Check its status with:
to start the server. Check its status with:


<code>sudo systemctl status calibre-server</code>
<code>sudo systemctl status calibre</code>


To make it start at boot, run:
To make it start at boot, run:


<code>sudo systemctl enable calibre-server</code>
<code>sudo systemctl enable calibre</code>


===== Note =====
===== Note =====

Revision as of 16:47, 3 December 2019

You can easily create a service to run calibre at boot on a modern (systemd) based Linux system. Just create the file /etc/systemd/system/calibre.service with the contents shown below:

   [Unit]
   Description=Calibre.
   After=syslog.target network.target
   
   [Service]
   Type=simple
   User=pi
   Group=pi
   WorkingDirectory=/home/pi/calibre-web
   ExecStart=python cps.py
   Restart=always
   
   [Install]
   WantedBy=multi-user.target

The User and group should be the same ones that own the files in the calibre library directory. Note that it is generally not a good idea to run the server as root. Also change the path to the calibre library directory to suit your system.

Now run:

sudo systemctl start calibre

to start the server. Check its status with:

sudo systemctl status calibre

To make it start at boot, run:

sudo systemctl enable calibre

Note

The calibre server does not need a running X server, but it does need the X libraries installed as some components it uses link against them.

The calibre server also supports systemd socket activation, so you can use that, if needed, as well.