systemd

Module Contents

Functions

listen_fds(unset_environment=True) Get the number of sockets inherited from systemd socket activation.
listen_fds(unset_environment=True)

Get the number of sockets inherited from systemd socket activation.

Parameters:unset_environment (bool) – clear systemd environment variables unless False
Returns:the number of sockets to inherit from systemd socket activation
Return type:int

Returns zero immediately if $LISTEN_PID is not set to the current pid. Otherwise, returns the number of systemd activation sockets specified by $LISTEN_FDS.

When $LISTEN_PID matches the current pid, unsets the environment variables unless the unset_environment flag is False.

Note

Unlike the sd_listen_fds C function, this implementation does not set the FD_CLOEXEC flag because the gunicorn arbiter never needs to do this.