Module: KStor::Systemd

Defined in:
lib/kstor/systemd.rb

Overview

Collection of methods for systemd integration.

Class Method Summary collapse

Class Method Details

.service_readyObject

Notify systemd that we’re ready to serve clients.



20
21
22
# File 'lib/kstor/systemd.rb', line 20

def service_ready
  SdNotify.ready
end

.service_stoppingObject

Notify systemd that we’re stopping.



25
26
27
# File 'lib/kstor/systemd.rb', line 25

def service_stopping
  SdNotify.stopping
end

.socketnil, Socket

Get main socket from systemd

Returns:

  • (nil, Socket)

    The socket or nil if systemd didn’t provide



12
13
14
15
16
17
# File 'lib/kstor/systemd.rb', line 12

def socket
  listen_pid = ENV['LISTEN_PID'].to_i
  return nil unless Process.pid == listen_pid

  Socket.for_fd(3)
end