On Thu, Oct 11, 2012 at 4:18 PM, Dmitry Golubovsky <[email protected]> wrote: > Hi, > > I am trying to implement a systemd service which provides a sort of > REPL (read-evall-print loop) to local clients connecting to its > control socket; at the simplest it would be "socat readline > /path/to/socket"). > A socket is preferred because the service may obtain credentials from > the caller to implement some access control. > > The .socket file looks like this: > > 1 [Unit] > 2 Description=some interactive service socket > 3 > 4 [Socket] > 5 ListenStream=/path/to/socket > 6 Accept=false > 7 PassCredentials=true > [...] > It does not work. The socket is being created when systemd starts it, > and upon the first connection to the socket the service script is > started. But when the script tries to write a reply to its stdout it > gets ENOTCONN (transport endpoint is not connected). and I see no > output coming from the script. > [...] > Inspection of /proc/XXX/fd shows that in both socat and systemd cases > the service process' handles 0 and 1 are connected to the same socket, > so no wrapper there.
When you have "Accept=false", systemd only passes your program the listener socket, which is not connected to any client – systemd expects the program to call accept() itself for every client. If you want inetd-style socket activation, with the program's stdin/stdout being connected to the client directly, use "Accept=true". -- Mantas Mikulėnas _______________________________________________ systemd-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/systemd-devel
