[][src]Module systemd::daemon

Enums

Listening

Options for checking whether a socket is in listening mode

SocketType

Constants

LISTEN_FDS_START

Number of the first passed file descriptor

STATE_BUSERROR

D-Bus-style error code in case of failure

STATE_ERRNO

Errno-style error code in case of failure

STATE_EXTEND_TIMEOUT_USEC

Extend the timeout for the current state.

STATE_FDNAME

Name the group of file descriptors sent to the service manager.

STATE_FDSTORE

Store file discriptors in the service manager.

STATE_FDSTOREREMOVE

Remove file discriptors from the service manager store.

STATE_MAINPID

Main PID of the daemon, in case systemd didn't fork it itself

STATE_READY

Tells systemd whether daemon startup is finished

STATE_RELOADING

Tells systemd the daemon is reloading its configuration

STATE_STATUS

Single-line status string describing daemon state

STATE_STOPPING

Tells systemd the daemon is stopping

STATE_WATCHDOG

Update the watchdog timestamp (set to 1). Daemon should do this regularly, if using this feature.

STATE_WATCHDOG_USEC

Reset the watchdog timeout during runtime.

Functions

booted

Returns true if the system was booted with systemd.

is_fifo

Identifies whether the passed file descriptor is a FIFO. If a path is supplied, the file descriptor must also match the path.

is_mq

Identifies whether the passed file descriptor is a POSIX message queue. If a path is supplied, it will also verify the name.

is_socket

Identifies whether the passed file descriptor is a socket. If family and type are supplied, they must match as well. See Listening for listening check parameters.

is_socket_inet

Identifies whether the passed file descriptor is an Internet socket. If family, type, and/or port are supplied, they must match as well. See Listening for listening check parameters.

is_socket_unix

Identifies whether the passed file descriptor is an AF_UNIX socket. If type are supplied, it must match as well. For normal sockets, leave the path set to None; otherwise, pass in the full socket path. See Listening for listening check parameters.

is_special

Identifies whether the passed file descriptor is a special character device. If a path is supplied, the file descriptor must also match the path.

listen_fds

Returns how many file descriptors have been passed. Removes the $LISTEN_FDS and $LISTEN_PID file descriptors from the environment if unset_environment is true

notify

Notifies systemd that daemon state has changed. state is made up of a set of key-value pairs. See sd-daemon.h for details. Some of the most common keys are defined as STATE_* constants in this module. Returns true if systemd was contacted successfully.

pid_notify

Similar to notify(), but this sends the message on behalf of the supplied PID, if possible.

pid_notify_with_fds

Similar to pid_notify(), but this also sends file descriptors to the store.

tcp_listener
watchdog_enabled

Returns a timeout in microseconds before which the watchdog expects a response from the process. If 0, the watchdog is disabled.