Method: Puma::SdNotify.notify
- Defined in:
- lib/puma/sd_notify.rb
.notify(state, unset_env = false) ⇒ Fixnum?
Notify systemd with the provided state, via the notification socket, if any.
Generally this method will be used indirectly through the other methods of the library.
132 133 134 135 136 137 138 139 140 141 142 143 144 |
# File 'lib/puma/sd_notify.rb', line 132 def self.notify(state, unset_env=false) sock = ENV["NOTIFY_SOCKET"] return nil if !sock ENV.delete("NOTIFY_SOCKET") if unset_env begin Addrinfo.unix(sock, :DGRAM).connect { |s| s.write state } rescue StandardError => e raise NotifyError, "#{e.class}: #{e.}", e.backtrace end end |