You are not logged in.
Last week I switched to systemd and I'm trying to get socket activation working. Unfortunately, I've found only this:
Currently we do not have guidance on how to write socket files as this is something that needs upstream code and they can add a proper .socket file at the same time.
Socket activation for this services is included in the packages: cups, sshd, saned. All I had to do was
systemctl enable service-name.socketinstead of
systemctl enable service-name.serviceAfter reading the man pages (systemd.service(5) and systemd.socket(5)) I was able to write .socket files for mpd and lighttpd. It's working for mpd, but not for lighttpd, (can't bind to port, see below).
Content of lighttpd.socket (mpd.socket looks pretty much the same):
[Unit]
Description=lighttpd socket
[Socket]
ListenStream=80
ListenStream=443
Service=lighttpd.service
[Install]
WantedBy=sockets.targetand for completeness the content of official lighttpd.service:
[Unit]
Description=A secure, fast, compliant and very flexible web-server
After=syslog.target network.target
[Service]
PrivateTmp=true
ExecStart=/usr/sbin/lighttpd-angel -D -f /etc/lighttpd/lighttpd.conf
ExecReload=/bin/kill -HUP $MAINPID
KillSignal=SIGINT
[Install]
WantedBy=multi-user.targetUsing `ss -a` command I've confirmed that systemd is listening on ports 80 and 443, but when I try to access localhost on these ports, the lighttpd service isn't started. In journalctl I get this:
Aug 06 16:30:41 asusntb lighttpd-angel[31265]: 2012-08-06 16:30:41: (network.c.379) can't bind to port: 80 Address already in use
Aug 06 16:30:41 asusntb lighttpd-angel[31265]: lighttpd-angel.c.140: child (pid=31271) exited normally with exitcode: 255
Aug 06 16:30:42 asusntb lighttpd-angel[31274]: 2012-08-06 16:30:42: (network.c.379) can't bind to port: 80 Address already in use
Aug 06 16:30:42 asusntb lighttpd-angel[31274]: lighttpd-angel.c.140: child (pid=31275) exited normally with exitcode: 255
Aug 06 16:30:42 asusntb lighttpd-angel[31277]: 2012-08-06 16:30:42: (network.c.379) can't bind to port: 80 Address already in use
Aug 06 16:30:42 asusntb lighttpd-angel[31277]: lighttpd-angel.c.140: child (pid=31278) exited normally with exitcode: 255
Aug 06 16:30:42 asusntb lighttpd-angel[31280]: 2012-08-06 16:30:42: (network.c.379) can't bind to port: 80 Address already in use
Aug 06 16:30:42 asusntb lighttpd-angel[31280]: lighttpd-angel.c.140: child (pid=31281) exited normally with exitcode: 255
Aug 06 16:30:42 asusntb lighttpd-angel[31283]: 2012-08-06 16:30:42: (network.c.379) can't bind to port: 80 Address already in use
Aug 06 16:30:42 asusntb lighttpd-angel[31283]: lighttpd-angel.c.140: child (pid=31284) exited normally with exitcode: 255
Aug 06 16:30:42 asusntb lighttpd-angel[31286]: 2012-08-06 16:30:42: (network.c.379) can't bind to port: 80 Address already in use
Aug 06 16:30:42 asusntb lighttpd-angel[31286]: lighttpd-angel.c.140: child (pid=31287) exited normally with exitcode: 255
Aug 06 16:30:42 asusntb systemd[1]: lighttpd.service start request repeated too quickly, refusing to start.
Aug 06 16:30:42 asusntb systemd[1]: Unit lighttpd.socket entered failed state.Any ideas?
Offline
sshd does not have socket activation in the systemd sense. sshd offers sshd.socket and a matching sshd@.service, which offers inetd style activation.
You really do need to patch daemons to support proper socket activation (see the daemon(7) manpage). mpd supports it, cups supposedly supports it. udev definitely supports it. lighttpd does not.
Offline
OK, thanks for pointing me to the right direction, I'll look into it...
Offline