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

From XPUB & Lens-Based wiki
(Created page with "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-server.service with the conte...")
 
No edit summary
Line 1: Line 1:
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-server.service with the contents shown below:
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-server.service with the contents shown below:


<code>[Unit]
    [Unit]
Description=calibre content server
    Description=calibre content server
After=network.target
    After=network.target
 
   
[Service]
    [Service]
Type=simple
    Type=simple
User=mylinuxuser
    User=mylinuxuser
Group=mylinuxgroup
    Group=mylinuxgroup
ExecStart=/opt/calibre/calibre-server "/path/to/calibre library directory"
    ExecStart=/opt/calibre/calibre-server "/path/to/calibre library directory"
 
   
[Install]
    [Install]
WantedBy=multi-user.target</code>
    WantedBy=multi-user.target</code>


Change <code>mylinuxuser</code> and <code>mylinuxgroup</code> to whatever user and group you want the server to run as. This should be the same user and group 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. You can add multiple libraries if needed. See the help for the calibre-server command.
Change <code>mylinuxuser</code> and <code>mylinuxgroup</code> to whatever user and group you want the server to run as. This should be the same user and group 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. You can add multiple libraries if needed. See the help for the calibre-server command.

Revision as of 15:50, 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-server.service with the contents shown below:

   [Unit]
   Description=calibre content server
   After=network.target
   
   [Service]
   Type=simple
   User=mylinuxuser
   Group=mylinuxgroup
   ExecStart=/opt/calibre/calibre-server "/path/to/calibre library directory"
   
   [Install]
   WantedBy=multi-user.target

Change mylinuxuser and mylinuxgroup to whatever user and group you want the server to run as. This should be the same user and group 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. You can add multiple libraries if needed. See the help for the calibre-server command.

Now run:

sudo systemctl start calibre-server

to start the server. Check its status with:

sudo systemctl status calibre-server

To make it start at boot, run:

sudo systemctl enable calibre-server

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.