/etc/systemd/system/calibre-server.service:
[Unit]
Description=Calibre Server
After=network.target
Requires=calibre-server.socket
[Service]
Type=forking
PIDFile=/run/calibre-server.pid
ExecStart=/usr/bin/calibre-server \
--daemonize \
--port=8888 \
--pidfile=/run/calibre-server.pid \
--with-library=/mnt/media/ebooks/calibre/ \
--url-prefix /calibre
[Install]
WantedBy=multi-user.target
Also=calibre-server.socket
/etc/systemd/system/calibre-server.socket:
[Unit]
Description=Calibre-server Socket
[Socket]
ListenStream=8888
Accept=false
[Install]
WantedBy=sockets.target
Just for reference, I have calibre-server starting just fine normally with this systemd unit file:
[Unit]
Description=Calibre Server
After=network.target
[Service]
Type=forking
PIDFile=/run/calibre-server.pid
ExecStart=/usr/bin/calibre-server \
--daemonize \
--port=8888 \
--pidfile=/run/calibre-server.pid \
--with-library=/mnt/media/ebooks/calibre/ \
--url-prefix /calibre
Restart=on-abort
[Install]
WantedBy=multi-user.target
Any ideas?
tl;dr - trying to auto-start/stop calibre-server with systemd on an on-demand basis
Any ideas, or am I out of luck on this?
Thanks!
Scott
Edit:
I don't know if this is relevant, but I still still see the 8888 port in netstat even when the service is stopped.
$ netstat -tlnp
....
tcp 0 0 0.0.0.0:8888 0.0.0.0:* LISTEN 3572/python2
.......