[ANN] Daemons 0.0.1: control your daemon scripts with start/stop commands

  • Thread starter Thomas Uehlinger
  • Start date
T

Thomas Uehlinger

I'm proud to release the first version of Daemons,
a tool to create scripts that run as daemons in the background and that can
be controlled by start/stop/restart commands (using pid-files).

Get it while it's hot as a gem ('gem install daemons') or from
http://rubyforge.org/projects/daemons or read on...

-- Thomas Uehlinger


From the README:
== What is Daemons?

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

Daemons includes the <tt>daemonize.rb</tt> script written by <i>Travis
Whitton</i> to do the daemonization
process.

== Basic Usage

Layout: suppose you have your self-written server <tt>myserver.rb</tt>:

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

loop do
sleep(5)
end

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

Just create <tt>myserver_control.rb</tt> like this:

# this is myserver_control.rb

require 'rubygems' # if you use RubyGems
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 <tt>myserver.rb</tt> <i>without
forking</i> in the background:

$ ruby myserver_control.rb run

An additional nice feature of Daemons is that you can pass <i>additional
arguments</i> to the script that
should be daemonized by seperating them by two _hyphens_:

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

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


== Download and Installation

*Download*: just go to http://rubyforge.org/projects/daemons/

Installation *with* RubyGems:
$ su
# gem install daemons

Installation *without* RubyGems:
$ tar xfz daemons-x.x.x.tar.gz
$ cd daemons-x.x.x
$ su
# ruby setup.rb

== Documentation

For further documentation, refer to the module documentation of Daemons
(click on Daemons).

The RDoc documentation is also online at http://daemons.rubyforge.org


== Author

Written in 2005 by Thomas Uehlinger <mailto:[email protected]>

== License

The Daemons script is copywrited free software by Thomas Uehlinger
<mailto:[email protected]>. You can redistribute it under the terms
specified in
the COPYING file of the Ruby distribution.


== Feedback and other resources

At http://rubyforge.org/projects/daemons.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

prob with daemon 2
Daemons lib not dong much?... 0
Daemons and Paths 3
[ANN] RubyGems 1.5.3 0
ANN: dh, the daemon helper 2009-09-04 0
[ANN] babelfish 0.0.1 5
[ANN] forkoff-0.0.1 0
ANN: dh, the daemon helper 2

Members online

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,165
Latest member
JavierBrak
Top