-
Notifications
You must be signed in to change notification settings - Fork 60
Arguments
Daemon-kit has a selection of buitin command line arguments, and allows you to specify your own arguments required by your daemons.
The first argument to any daemon indicates the mode of operation, and
can be one of run (default), start or stop.
The only difference is run won't fork the daemon into the background,
and present the output of the loggers to STDOUT.
Stops a running daemon. If the --pidfile argument is provided
The following options are handled by daemon-kit:
- -e, --env environment - The environment of the daemon (defaults to
development - -l, --log path - Full path to the log file
- --pid path - Full path to the pid file
- -v, --version - Prints out the daemon-kit version
- -h, --help - Prints out the help
Custom arguments are specified in config/arguments.rb. 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