[systemd-devel] .service and .socket

Michael Chapman mike at very.puzzling.org
Wed Jan 2 10:49:05 UTC 2019


On Wed, 2 Jan 2019, Reindl Harald wrote:
[...]
> agreed, but why can't have socket simply optional a [Service] section to
> save the "demo at .service" in cases like below?
> 
> [root at client:/etc/systemd/system]$ cat demo.socket
> [Unit]
> Description=Demo Server - Activation Socket
> 
> [Socket]
> Accept=yes
> ListenStream=0.0.0.0:7
> ListenStream=0.0.0.0:19
> ListenStream=0.0.0.0:21
> 
> [Service]
> Type=oneshot
> ExecStart=/usr/bin/echo "DEMO-SERVICE"
> StandardOutput=socket
> StandardInput=socket
> 
> [Install]
> WantedBy=sockets.target

Presumably things in [Unit] would only apply to the socket. What if the 
service needs [Unit] directives itself? Do we really want yet another 
special case ("you can embed the service inside the socket... but only if 
the service doesn't need [Unit] directives")?

I really don't think combining two units into one file makes things 
simpler.


More information about the systemd-devel mailing list