forked from kennethkalmer/daemon-kit
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7eff725
commit f139b3e
Showing
14 changed files
with
123 additions
and
150 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
*#* | ||
pkg/ | ||
tmp/ | ||
doc/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
= Configuring your daemon | ||
|
||
daemon-kit provides a multitude of ways to configure your daemon, this document | ||
will outline the different options available to you. | ||
|
||
== Configuration files and #DaemonKit::Config | ||
|
||
#DaemonKit::Config gives you easy access to any YAML configuration | ||
files you have in your <em>config</em> directory. | ||
|
||
You can access the configuration files like this: | ||
|
||
config = DaemonKit::Config.load('sample') | ||
|
||
The above snippet relies on the presence of a <em>config/sample.yml</em> file. | ||
|
||
#DaemonKit::Config is environment aware, so configuration files are | ||
parsed for a top-level key that is the same as the value of | ||
<em>DAEMON_ENV</em>, and if present is loaded into the object as the | ||
configuration data. If the key is not present, the whole YAML | ||
document is exposed as configuration data. | ||
|
||
== Command line arguments | ||
|
||
The most flexible way to configure your daemon is through command line | ||
arguments, or switches. | ||
|
||
DaemonKit includes a couple of its own arguments that can be used: | ||
|
||
-e ENV (or --env ENV) to set the daemon environment | ||
--pid /path/to/pidfile to set the path to a pidfile | ||
-v shows the DaemonKit version | ||
-h shows a useful help message | ||
|
||
=== Custom arguments | ||
|
||
It is possible for you to specify your own arguments as well, by | ||
updating the <em>config/arguments.rb</em> file. This file is eval'd | ||
inside #DaemonKit::Arguments and gives you access to the following two | ||
variables: | ||
|
||
* opts - Instance of OptionParser[http://www.ruby-doc.org/stdlib/libdoc/optparse/rdoc/classes/OptionParser.html] | ||
* @options - A standard Ruby hash that you can populate and access later | ||
|
||
Your custom arguments can be accessed like this: | ||
|
||
DaemonKit.arguments.options | ||
|
||
=== Advanced Configuration | ||
|
||
All the writable attributes of the default #DaemonKit::Configuration | ||
instance call also be modified from the command line using the special | ||
<em>--config</em> arguments: | ||
|
||
--config force_kill_wait=30 | ||
|
||
This happens after <em>config/environment.rb</em> is processed, so all | ||
command line arguments will overwrite those values. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Argument handling for your daemon is configured here. | ||
# | ||
# You have access to two variables when this file is | ||
# parsed. The first is +opts+, which is the object yielded from | ||
# +OptionParser.new+, the second is +@options+ which is a standard | ||
# Ruby hash that is later accessible through | ||
# DaemonKit.arguments.options and can be used in your daemon process. | ||
|
||
# Here is an example: | ||
# opts.on('-f', '--foo FOO', 'Set foo') do |foo| | ||
# @options[:foo] = foo | ||
# end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
host: kennethkalmer@rubyforge.org | ||
remote_dir: /var/www/gforge-projects/kit/daemon-kit/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.