You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

115 lines
8.0 KiB
HTML

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<!DOCTYPE html>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Tasks of the Contingent Librarian</title>
<link rel="stylesheet" type="text/css" href="tasks.css">
<script src="tasks.js"></script>
</head>
<body>
<div class="cardback"><DOCUMENT_FRAGMENT><div class="mw-parser-output"><div class="thumb tright"><div class="thumbinner" style="width:152px;"><a class="image" href="File:Bl_announcement_poster.jpeg.html"><img alt="" class="thumbimage" decoding="async" height="106" src="/mw-mediadesign/images/thumb/8/82/Bl_announcement_poster.jpeg/150px-Bl_announcement_poster.jpeg" srcset="/mw-mediadesign/images/thumb/8/82/Bl_announcement_poster.jpeg/225px-Bl_announcement_poster.jpeg 1.5x, /mw-mediadesign/images/thumb/8/82/Bl_announcement_poster.jpeg/300px-Bl_announcement_poster.jpeg 2x" width="150"></a> <div class="thumbcaption"><div class="magnify"><a class="internal" href="File:Bl_announcement_poster.jpeg.html" title="Enlarge"></a></div>Poster announcing the bootleg library, July 2019</div></div></div>
<div class="toc" id="toc"><input class="toctogglecheckbox" id="toctogglecheckbox" role="button" style="display:none" type="checkbox"><div class="toctitle" dir="ltr" lang="en"><h2>Contents</h2><span class="toctogglespan"><label class="toctogglelabel" for="toctogglecheckbox"></label></span></div>
<ul>
<li class="toclevel-1"><a href="#calibre-web_configuration"><span class="tocnumber">1</span> <span class="toctext">calibre-web configuration</span></a>
<ul>
<li class="toclevel-2"><a href="#Creating_a_unit_file"><span class="tocnumber">1.1</span> <span class="toctext">Creating a unit file</span></a></li>
<li class="toclevel-2"><a href="#Starting_the_calibre-server_service"><span class="tocnumber">1.2</span> <span class="toctext">Starting the calibre-server service</span></a></li>
<li class="toclevel-2"><a href="#Stopping_the_calibre-server_service"><span class="tocnumber">1.3</span> <span class="toctext">Stopping the calibre-server service</span></a></li>
<li class="toclevel-2"><a href="#Checking_the_status_of_the_calibre-server_service"><span class="tocnumber">1.4</span> <span class="toctext">Checking the status of the calibre-server service</span></a></li>
<li class="toclevel-2"><a href="#Enabling_the_calibre-server_service_to_start_at_boot"><span class="tocnumber">1.5</span> <span class="toctext">Enabling the calibre-server service to start at boot</span></a>
<ul>
<li class="toclevel-3"><a href="#Note"><span class="tocnumber">1.5.1</span> <span class="toctext">Note</span></a></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<h2><span class="mw-headline" id="calibre-web_configuration">calibre-web configuration</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/mw-mediadesign/index.php?title=User:Simon/prototypes/calibre-web_configuration&amp;action=edit&amp;section=T-1" title="Edit section: ">edit</a><span class="mw-editsection-bracket">]</span></span></h2>
<p>This is the configuration for calibre-web to listen on localhost:
</p>
<pre>--- a/cps/server.py
+++ b/cps/server.py
@@ -152,7 +152,7 @@ class WebServer(object):
http_server = HTTPServer(WSGIContainer(self.app),
max_buffer_size=209700000,
ssl_options=self.ssl_args)
- http_server.listen(self.listen_port, self.listen_address)
+ http_server.listen(self.listen_port, address="127.0.0.1")
self.wsgiserver = IOLoop.instance()
self.wsgiserver.start()
# wait for stop signal
</pre>
<h3><span class="mw-headline" id="Creating_a_unit_file">Creating a unit file</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/mw-mediadesign/index.php?title=User:Simon/Trim4/prototypes/calibre_service_file&amp;action=edit&amp;section=T-1" title="Edit section: ">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
<p>You can easily create a unit file for calibre to run on boot on a modern (systemd) based Linux system. This means it will also restart after a crash. Create the file <code>/etc/systemd/system/calibre-server.service</code> with the contents shown below:
</p>
<pre>[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</pre>
<p>The <code>User</code> and <code>Group</code> should be the same ones that own the files in the calibre library directory. It's generally not a good idea to run the server as root. Also change the path to the calibre library directory to suit your system.
</p>
<h3><span class="mw-headline" id="Starting_the_calibre-server_service">Starting the calibre-server service</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/mw-mediadesign/index.php?title=User:Simon/Trim4/prototypes/calibre_service_file&amp;action=edit&amp;section=T-2" title="Edit section: ">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
<p>Run:
</p><p><code>sudo systemctl start calibre-server</code>
</p><p>to start the server.
</p>
<h3><span class="mw-headline" id="Stopping_the_calibre-server_service">Stopping the calibre-server service</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/mw-mediadesign/index.php?title=User:Simon/Trim4/prototypes/calibre_service_file&amp;action=edit&amp;section=T-3" title="Edit section: ">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
<p>Stopping the service is as easy as running:
</p><p><code>sudo systemctl stop calibre-server</code>
</p>
<h3><span class="mw-headline" id="Checking_the_status_of_the_calibre-server_service">Checking the status of the calibre-server service</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/mw-mediadesign/index.php?title=User:Simon/Trim4/prototypes/calibre_service_file&amp;action=edit&amp;section=T-4" title="Edit section: ">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
<p>Check its status with:
</p><p><code>sudo systemctl status calibre-server</code>
</p>
<h3><span class="mw-headline" id="Enabling_the_calibre-server_service_to_start_at_boot">Enabling the calibre-server service to start at boot</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/mw-mediadesign/index.php?title=User:Simon/Trim4/prototypes/calibre_service_file&amp;action=edit&amp;section=T-5" title="Edit section: ">edit</a><span class="mw-editsection-bracket">]</span></span></h3>
<p>To make it start at boot, run:
</p><p><code>sudo systemctl enable calibre-server</code>
</p>
<h5><span class="mw-headline" id="Note">Note</span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/mw-mediadesign/index.php?title=User:Simon/Trim4/prototypes/calibre_service_file&amp;action=edit&amp;section=T-6" title="Edit section: ">edit</a><span class="mw-editsection-bracket">]</span></span></h5>
<p>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.
</p><p>The calibre server also supports systemd socket activation, so you can use that, if needed, as well.
</p>
<!--
NewPP limit report
Cached time: 20200612082936
Cache expiry: 86400
Dynamic content: false
CPU time usage: 0.031 seconds
Real time usage: 0.071 seconds
Preprocessor visited node count: 18/1000000
Preprocessor generated node count: 58/1000000
Postexpand include size: 1656/2097152 bytes
Template argument size: 0/2097152 bytes
Highest expansion depth: 2/40
Expensive parser function count: 0/100
Unstrip recursion depth: 0/20
Unstrip postexpand size: 745/5000000 bytes
-->
<!--
Transclusion expansion time report (%,ms,calls,template)
100.00% 20.176 1 -total
83.88% 16.923 1 User:Simon/Trim4/prototypes/calibre_service_file
15.29% 3.085 1 User:Simon/prototypes/calibre-web_configuration
-->
<!-- Saved in parser cache with key wdka_mw_mediadesign-mw_:pcache:idhash:31721-0!canonical and timestamp 20200612082936 and revision id 174004
-->
</div></DOCUMENT_FRAGMENT></div>
</body>
</html>