Project

pidly

0.01
No commit activity in last 3 years
No release in over 3 years
Pidly is a very minimalistic daemon library that doesnt make assumptions. Pidly allows you to control the daemon without getting in the way with forced verbose output and usage messages.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 0.4
~> 2.4
~> 0.6.0
 Project Readme

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.