A summary of data about the Ruby ecosystem.

https://github.com/thuehlinger/daemons

Ruby daemons gem official repository
https://github.com/thuehlinger/daemons

Keywords from Contributors

activerecord activejob mvc rubygem feature-flag crash-reporting rack rspec feature-toggle feature

Last synced: about 21 hours ago
JSON representation

Repository metadata

Ruby daemons gem official repository

README.md

Ruby Daemons

Build StatusCode ClimateTest Coverage

Daemons provides an easy way to wrap existing ruby scripts (for example a self-written server)
to be run as a daemon and to be controlled by simple start/stop/restart commands.

If you want, you can also use daemons to run blocks of ruby code in a daemon process and to control
these processes from the main application.

Besides this basic functionality, daemons offers many advanced features like exception backtracing
and logging (in case your ruby script crashes) and monitoring and automatic restarting of your processes
if they crash.

Basic Usage

You can use Daemons in four different ways:

1. Create wrapper scripts for your server scripts or applications

Layout: suppose you have your self-written server myserver.rb:

# this is myserver.rb
# it does nothing really useful at the moment

loop do
  sleep(5)
end

To use myserver.rb in a production environment, you need to be able to
run myserver.rb in the background (this means detach it from the console, fork it
in the background, release all directories and file descriptors).

Just create myserver_control.rb like this:

# this is myserver_control.rb
require 'daemons'

Daemons.run('myserver.rb')

And use it like this from the console:

$ ruby myserver_control.rb start
    (myserver.rb is now running in the background)
$ ruby myserver_control.rb restart
    (...)
$ ruby myserver_control.rb stop

For testing purposes you can even run myserver.rb without forking in the background:

$ ruby myserver_control.rb run

An additional nice feature of Daemons is that you can pass additional arguments to the script that
should be daemonized by seperating them by two hyphens:

$ ruby myserver_control.rb start -- --file=anyfile --a_switch another_argument

2. Create wrapper scripts that include your server procs

Layout: suppose you have some code you want to run in the background and control that background process
from a script:

# this is your code
# it does nothing really useful at the moment

loop do
  sleep(5)
end

To run this code as a daemon create myproc_control.rb like this and include your code:

# this is myproc_control.rb
require 'daemons'

Daemons.run_proc('myproc.rb') do
  loop do
    sleep(5)
  end
end

And use it like this from the console:

$ ruby myproc_control.rb start
    (myproc.rb is now running in the background)
$ ruby myproc_control.rb restart
    (...)
$ ruby myproc_control.rb stop

For testing purposes you can even run myproc.rb without forking in the background:

$ ruby myproc_control.rb run

3. Control a bunch of daemons from another application

Layout: you have an application my_app.rb that wants to run a bunch of
server tasks as daemon processes.

# this is my_app.rb
require 'daemons'

task1 = Daemons.call(:multiple => true) do
  # first server task

  loop do
    conn = accept_conn()
    serve(conn)
  end
end

task2 = Daemons.call do
  # second server task

  loop do
    something_different()
  end
end

# the parent process continues to run

# we can even control our tasks, for example stop them
task1.stop
task2.stop

exit

4. Daemonize the currently running process

Layout: you have an application my_daemon.rb that wants to run as a daemon
(but without the ability to be controlled by daemons via start/stop commands)

# this is my_daemons.rb
require 'daemons'

# Initialize the app while we're not a daemon
init()

# Become a daemon
Daemons.daemonize

# The server loop
loop do
  conn = accept_conn()
  serve(conn)
end

For further documentation, refer to the module documentation of Daemons.

Displaying daemon status

When daemonizing a process using a wrapper script, as examples 1 and 2 above,
the status can be shown using

$ ruby myproc_control.rb status

By default this will display whether or not the daemon is running and, if it
is, its PID.

A custom message can be shown with

def custom_show_status(app)
  # Display the default status information
  app.default_show_status

  puts
  puts "PS information"
  system("ps -p #{app.pid.pid.to_s}")

  puts
  puts "Size of log files"
  system("du -hs /path/to/logs")
end

Daemons.run('myserver.rb', { show_status_callback: :custom_show_status })

Documentation

Documentation can be found at http://www.rubydoc.info/gems/daemons.

Author

Written 2005-2021 by Thomas Uehlinger, 2014-2016 by Aaron Stone.


Owner metadata


GitHub Events

Total
Last Year

Committers metadata

Last synced: 3 days ago

Total Commits: 183
Total Committers: 29
Avg Commits per committer: 6.31
Development Distribution Score (DDS): 0.563

Commits in past year: 0
Committers in past year: 0
Avg Commits per committer in past year: 0.0
Development Distribution Score (DDS) in past year: 0.0

Name Email Commits
Thomas Uehlinger t****r@g****m 80
Adam Cuppy a****m@c****m 43
Aaron Stone a****n@s****x 19
Peter Goldstein p****n@g****m 4
Ryan Lue h****o@r****m 4
Denys Matveev s****3@g****m 3
Paul Gallagher g****l@g****m 3
dingoEgret s****t@g****m 2
Andreas Bomholtz a****s@s****m 2
Ivan Nečas i****s@r****m 2
Tobias Thiel t****1@g****m 2
dependabot[bot] 4****] 2
Willian Gustavo Veiga w****a 1
Joe Haig j****g@b****k 1
Philipp Großelfinger p****r@a****e 1
paul p****l@c****m 1
roberto.plancarte r****e@o****m 1
W. Andrew Loe III a****w@a****m 1
Ryuta Kamizono k****o@g****m 1
Robert Schulze r****t@d****e 1
Philipp p****g@p****m 1
Olle Jonsson o****n@g****m 1
Lukas Zapletal l****t@r****m 1
Luis M Rodriguez-R l****r@g****m 1
Kazuki Nishikawa k****a@g****m 1
Graham Rogers g****m@o****m 1
Daniel Sinn d****n@p****m 1
Christian Schmidt cs@f****k 1
Akira Matsuda r****e@d****p 1

Committer domains:


Issue and Pull Request metadata

Last synced: 2 months ago

Total issues: 50
Total pull requests: 45
Average time to close issues: 2 months
Average time to close pull requests: 26 days
Total issue authors: 44
Total pull request authors: 29
Average comments per issue: 2.64
Average comments per pull request: 1.29
Merged pull request: 39
Bot issues: 0
Bot pull requests: 5

Past year issues: 0
Past year pull requests: 3
Past year average time to close issues: N/A
Past year average time to close pull requests: 3 months
Past year issue authors: 0
Past year pull request authors: 1
Past year average comments per issue: 0
Past year average comments per pull request: 0.33
Past year merged pull request: 0
Past year bot issues: 0
Past year bot pull requests: 3

More stats: https://issues.ecosyste.ms/repositories/lookup?url=https://github.com/thuehlinger/daemons

Top Issue Authors

  • thuehlinger (7)
  • scooler (1)
  • Paxa (1)
  • parhs (1)
  • bwinter (1)
  • dideler (1)
  • floodico (1)
  • tboyko (1)
  • hrenfroe (1)
  • utkarshrai003 (1)
  • robertoplancarte (1)
  • lmrodriguezr (1)
  • sada (1)
  • trombik (1)
  • boncey (1)

Top Pull Request Authors

  • sodabrew (8)
  • dependabot[bot] (5)
  • petergoldstein (3)
  • SephVelut (2)
  • intentionaccident (2)
  • tardate (2)
  • iNecas (1)
  • TastyPi (1)
  • rlue (1)
  • AndreasBomholtz (1)
  • acuppy (1)
  • dsinn (1)
  • phigrofi (1)
  • tobithiel (1)
  • amatsuda (1)

Top Issue Labels

  • bug (5)
  • question (3)
  • enhancement (2)
  • help wanted (1)

Top Pull Request Labels

  • dependencies (5)
  • github_actions (3)

Package metadata

gem.coop: daemons

Daemons provides an easy way to wrap existing ruby scripts (for example a self-written server) to be run as a daemon and to be controlled by simple start/stop/restart commands. You can also call blocks as daemons and control them from the parent or just daemonize the current process. Besides this basic functionality, daemons offers many advanced features like exception backtracing and logging (in case your ruby script crashes) and monitoring and automatic restarting of your processes if they crash.

  • Homepage: https://github.com/thuehlinger/daemons
  • Documentation: http://www.rubydoc.info/gems/daemons/
  • Licenses: MIT
  • Latest release: 1.4.1 (published over 4 years ago)
  • Last Synced: 2026-02-28T11:31:55.748Z (3 days ago)
  • Versions: 38
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 306,988,910 Total
  • Docker Downloads: 666,068,489
  • Rankings:
    • Dependent repos count: 0.0%
    • Dependent packages count: 0.0%
    • Average: 0.025%
    • Downloads: 0.074%
  • Maintainers (1)
rubygems.org: daemons

Daemons provides an easy way to wrap existing ruby scripts (for example a self-written server) to be run as a daemon and to be controlled by simple start/stop/restart commands. You can also call blocks as daemons and control them from the parent or just daemonize the current process. Besides this basic functionality, daemons offers many advanced features like exception backtracing and logging (in case your ruby script crashes) and monitoring and automatic restarting of your processes if they crash.

  • Homepage: https://github.com/thuehlinger/daemons
  • Documentation: http://www.rubydoc.info/gems/daemons/
  • Licenses: MIT
  • Latest release: 1.4.1 (published over 4 years ago)
  • Last Synced: 2026-03-01T07:02:46.073Z (3 days ago)
  • Versions: 38
  • Dependent Packages: 455
  • Dependent Repositories: 77,190
  • Downloads: 307,009,084 Total
  • Docker Downloads: 666,068,489
  • Rankings:
    • Downloads: 0.072%
    • Dependent packages count: 0.1%
    • Dependent repos count: 0.133%
    • Docker downloads count: 0.584%
    • Average: 1.048%
    • Stargazers count: 2.28%
    • Forks count: 3.12%
  • Maintainers (1)
proxy.golang.org: github.com/thuehlinger/daemons

  • Homepage:
  • Documentation: https://pkg.go.dev/github.com/thuehlinger/daemons#section-documentation
  • Licenses: mit
  • Latest release: v1.4.1 (published over 4 years ago)
  • Last Synced: 2026-02-27T22:02:04.607Z (4 days ago)
  • Versions: 11
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Rankings:
    • Stargazers count: 2.434%
    • Forks count: 2.987%
    • Average: 6.44%
    • Dependent packages count: 9.56%
    • Dependent repos count: 10.779%
ubuntu-24.04: ruby-daemons

  • Homepage: https://github.com/thuehlinger/daemons
  • Licenses:
  • Latest release: 1.4.1-2 (published 25 days ago)
  • Last Synced: 2026-02-06T15:04:05.178Z (25 days ago)
  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Rankings:
ubuntu-23.04: ruby-daemons

  • Homepage: https://github.com/thuehlinger/daemons
  • Licenses: mit
  • Latest release: 1.4.1-1 (published 21 days ago)
  • Last Synced: 2026-02-11T06:37:41.105Z (21 days ago)
  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Rankings:
    • Dependent repos count: 0.0%
    • Dependent packages count: 0.0%
    • Average: 100%
ubuntu-23.10: ruby-daemons

  • Homepage: https://github.com/thuehlinger/daemons
  • Licenses: mit
  • Latest release: 1.4.1-1 (published 18 days ago)
  • Last Synced: 2026-02-13T18:17:45.604Z (18 days ago)
  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Rankings:
    • Dependent repos count: 0.0%
    • Dependent packages count: 0.0%
    • Average: 100%
debian-12: ruby-daemons

  • Homepage: https://github.com/thuehlinger/daemons
  • Documentation: https://packages.debian.org/bookworm/ruby-daemons
  • Licenses:
  • Latest release: 1.4.1-1 (published 19 days ago)
  • Last Synced: 2026-02-12T23:27:46.707Z (19 days ago)
  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Rankings:
    • Dependent repos count: 0.0%
    • Dependent packages count: 0.0%
    • Average: 100%
debian-13: ruby-daemons

  • Homepage: https://github.com/thuehlinger/daemons
  • Documentation: https://packages.debian.org/trixie/ruby-daemons
  • Licenses: mit
  • Latest release: 1.4.1-2 (published 19 days ago)
  • Last Synced: 2026-02-13T13:14:31.184Z (18 days ago)
  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Rankings:
    • Dependent repos count: 0.0%
    • Dependent packages count: 0.0%
    • Average: 100%
ubuntu-24.10: ruby-daemons

  • Homepage: https://github.com/thuehlinger/daemons
  • Licenses:
  • Latest release: 1.4.1-2 (published 22 days ago)
  • Last Synced: 2026-02-09T16:23:43.354Z (22 days ago)
  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Rankings:

Dependencies

daemons.gemspec rubygems
  • rake ~> 12.3, >= 12.3.3 development
  • rspec ~> 3.1 development
  • simplecov ~> 0 development
.github/workflows/ci.yml actions
  • actions/checkout v3 composite
  • ruby/setup-ruby v1 composite
Gemfile rubygems

Score: 31.26521661822466