GitXplorerGitXplorer
a

ruby-sdnotify

public
50 stars
8 forks
2 issues

Commits

List of commits on branch master.
Unverified
98eaf641d597c489051af660a5a8edc3939da1d2

Fix `watchdog?`'s YARD doc to be @return

bbensheldon committed a year ago
Unverified
0dcbd7c611f9b1e59cdb6a41d641101122e6112d

Run Ruby 2.2 on older ubuntu-20.04

mmarcogregorius committed a year ago
Unverified
13d58762c71a2ad53b4180ef6fde2499cb7dc1d9

Add Ruby 3.2 for CI tests

mmarcogregorius committed a year ago
Unverified
cca575cfd8d555e2c4667c9ad68f2c64bd6fcb01

Update license years

aagis committed 2 years ago
Unverified
275fe17b30356a32564ac8494746629e5a087bef

Update CI status badge for GitHub Actions

aagis committed 2 years ago
Unverified
f9c6b992c4ed6d4f954178650bbc17ee2100e5a3

switch to github action

sseuros committed 2 years ago

README

The README file for this repository.

ruby-sdnotify

Gem Version Build status Documentation License

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 sd_notify

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

gem "sd_notify"

Usage

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 involving a dummy workload (assuming the program is shipped as a systemd service):

require "sd_notify"

puts "Hello! Booting..."

# doing some initialization work...
sleep 2

# notify systemd that we're ready
SdNotify.ready

sum = 0
5.times do |i|
  # doing our main work...
  sleep 1

  sum += 1

  # notify systemd of our progress
  SdNotify.status("{sum} jobs completed")
end

puts "Finished working. Shutting down..."

# notify systemd we're shutting down
SdNotify.stopping

# doing some cleanup work...
sleep 2

puts "Bye"

License

ruby-sdnotify is licensed under MIT. See LICENSE.