[systemd-devel] How to implement a demon process by socket activation

Lennart Poettering lennart at poettering.net
Wed Sep 11 07:23:15 PDT 2013


On Wed, 11.09.13 21:33, Tony Seo (tonyseo7 at gmail.com) wrote:

> Hi
> I have been aiming to make a demon process by socket activation in systemd.
> you know that,  it was provided for socket activation in systemd homepage
> like below .
> http://0pointer.de/blog/projects/socket-activation.html
> 
> I refered that guide for making a daemon process started using socket
> activation.
> 
> I just followed the explanation in that site and tried to make a pair of
> server/client program on TCP/IP.( I just only added a sd_listen_fds()
> library fuction in server process using sd-daemon library)
> 
> But it didn't work when I started server process.
> 
> those processes  include  almost same code with following the guide.
> 
> Is that all to make a daemon process by socket activation in homepage?

Yes, usually it is. Note however that some daemons close all open fds
during initialization. You need to exclude the socket actviation fds
from that.

It might be useful to play around with the new systemd-activate tool in
order to debug this. See "man 8 systemd-activate".

Lennart

-- 
Lennart Poettering - Red Hat, Inc.


More information about the systemd-devel mailing list