Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using micro-httpd with systemd #9

Open
wolfgang42 opened this issue Feb 20, 2022 · 0 comments
Open

Using micro-httpd with systemd #9

wolfgang42 opened this issue Feb 20, 2022 · 0 comments

Comments

@wolfgang42
Copy link
Owner

https://www.acme.com/software/micro_httpd/

my-http-server@.service:

[Unit]  
Description=micro-httpd

[Service]
Type=simple
ExecStart=micro-httpd /path/to/serve
StandardInput=socket
StandardOutput=socket
StandardError=journal
DynamicUser=yes
PrivateUsers=true

(note the @, this is a template, more on this below)

my-http-server.socket:

[Socket]
ListenStream=13688
Accept=yes

[Install]
WantedBy=sockets.target

Also need to

systemctl daemon-reload
systemctl start my-http-server.socket
systemctl enable my-http-server.socket

Template will create entries like:

my-http-server@3-10.1.23.10:13688-10.1.23.101:37440.service

With help from https://mgdm.net/weblog/systemd-socket-activation/ and https://gist.github.com/drmalex07/28de61c95b8ba7e5017c

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant