Gem Version Documentation

A pure Ruby implementation of sd_notify(3) that can be used to communicate state changes of Ruby programs to systemd.

Refer to the API documentation for more info.

Getting started

Install ruby-sdnotify:

$ gem install ruby-sdnotify

If you're using Bundler, add it to your Gemfile:

gem "ruby-sdnotify"

and run bundle install.


The API is mostly tied to the official implementation, therefore refer to the sd_notify(3) man pages for detailed description of how the notification mechanism works.

An example (assuming the program shipped as a systemd service):

require "sd_notify"

puts "Hello. Booting..."
sleep 2 # do some initialization work ...

sum = 0
5.times do |i|
  sleep 1 # perform some work
  sum += 1
  SdNotify.status("{sum} jobs completed")

puts "Finished working, shutting down..."
sleep 2 # do cleanup work...


ruby-sdnotify is licensed under MIT. See LICENSE.