Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Tree: 225ba08e46
Fetching contributors…

Cannot retrieve contributors at this time

60 lines (39 sloc) 1.078 kB

pidly

Description

Pidly is a very minimalistic daemon library that doesn't make assumptions. Pidly allows you to control the daemon without getting in the way with forced verbose output and usage messages.

Examples

require 'pidly'

class Test < Pidly::Control

  before_start do
    puts "BEFORE START #{@pid}"
  end

  start :when_daemon_starts

  stop do
    puts "Attempting to kill process: #{@pid}"
  end

  after_stop :test_after_daemon_stops

  error do
    puts "SENDING EMAIL | Error Count: #{@error_count}"
  end

  def when_daemon_starts
    loop do
      print "TEST FROM #{@pid}"
      sleep 2
    end
  end

end

@daemon = Test.spawn(
  :name => 'Test Daemon',
  :path => '/tmp',
  :verbose => true
)

# @daemon.send ARGV.first
@daemon.start # stop, status, restart, clean!, and kill.

Install

$ gem install pidly

Copyright

Copyright (c) 2011 Dustin Willis Webber

See LICENSE.txt for details.

Jump to Line
Something went wrong with that request. Please try again.