module SystemD
Overview
Wrapper for libsystemd http://man7.org/linux/man-pages/man3/sd_pid_notify_with_fds.3.html http://man7.org/linux/man-pages/man3/sd_listen_fds_with_names.3.html
Defined in:
memory_pressure.crsystemd.cr
Constant Summary
-
LISTEN_FDS_START =
3
Class Method Summary
- .is_listening?(fd)
-
.is_socket?(fd : Int, family : Socket::Family, type : Socket::Type, listening : Int) : Bool
Checks if a FD refers to a socket of the specified type https://www.man7.org/linux/man-pages/man3/sd_is_socket_unix.3.html
- .is_tcp_listener?(fd : Int)
- .is_tcp_socket?(fd : Int)
- .is_udp_listener?(fd : Int)
- .is_udp_socket?(fd : Int)
- .is_unix_dgram_listener?(fd : Int)
- .is_unix_dgram_socket?(fd : Int)
- .is_unix_stream_listener?(fd : Int)
- .is_unix_stream_socket?(fd : Int)
- .listen_fds : Indexable(Int32)
- .listen_fds_with_names : Indexable(Tuple(Int32, String))
- .listeners : Indexable(Socket)
- .listening_socket?(fd : Int)
- .named_listeners : Indexable(Tuple(Socket, String))
- .notify(message = "READY=1\n") : Bool
- .notify_ready
- .notify_reloading
- .notify_status(status : String)
- .notify_stopping
- .remove_fds(name : String)
- .store_fds(fds : Array(Int32), name : String) : Bool
- .store_fds(fds : Array(Int32)) : Bool
- .tcp_socket?(fd : Int)
- .udp_socket?(fd : Int)
- .unix_dgram_socket?(fd : Int)
- .unix_stream_socket?(fd : Int)
-
.watchdog(&callback : -> _)
Report to systemd in a separate fiber The callback should return a trueish value or else the keepalive won't be sent If systemd doesn't get a ping every
WATCHDOG_USECit will kill the process. - .watchdog
- .watchdog_interval? : Time::Span | Nil
Class Method Detail
Checks if a FD refers to a socket of the specified type https://www.man7.org/linux/man-pages/man3/sd_is_socket_unix.3.html
Report to systemd in a separate fiber
The callback should return a trueish value or else the keepalive won't be sent
If systemd doesn't get a ping every WATCHDOG_USEC it will kill the process.
This method can always be called, if watchdog isn't enabled in systemd or
the process is not running under systemd it will do nothing.