Start Calibre-Web as service under Linux with systemd
If you want to get Calibre-Web started automatically after reboot follow this instructions. Create a file cps.service
as root in the folder /etc/systemd/system with the following content:
Replace the elements in {}
like User, ExecStart and WorkingDirectory with your username and file- and foldernames.
Service file for installation via pip
Find the location of the Calibre-Web starterfile cps
, this should be something like /home/<user>/.local/bin/cps
.
[Unit]
Description=Calibre-Web
[Service]
Type=simple
User={Username}
ExecStart={path to starterfile}
[Install]
WantedBy=multi-user.target
Another option is using {path to correct pythoninstance} -m cps
in the ExecStart line of the starterfile. The correct python instance depends on how you installed Calibre-Web via pip (e.g. virtual environment, system interpreter)
Service file for manual installation ("from source")
[Unit]
Description=Calibre-Web
[Service]
Type=simple
User={Username}
ExecStart={path to python} {/PATH/TO/cps.py including cps.py}
WorkingDirectory={/PATH/OF/CPS.PY without cps.py}
[Install]
WantedBy=multi-user.target
E.g
nano /etc/systemd/system/cps.service
[Unit]
Description=Calibre-Web
[Service]
Type=simple
User=ubuntu
ExecStart=/opt/calibre-web/venv/bin/python3 /opt/calibre-web/cps.py
WorkingDirectory=/opt/calibre-web/
[Install]
WantedBy=multi-user.target
Start Service
Enable the service.
sudo systemctl enable cps.service
Start the service.
sudo systemctl start cps.service
Check the status of the service or any errors.
sudo systemctl status cps.service