diff options
author | Seth Vargo <sethvargo@gmail.com> | 2013-06-07 17:42:14 -0700 |
---|---|---|
committer | Seth Vargo <sethvargo@gmail.com> | 2013-06-07 17:42:14 -0700 |
commit | ec735cbc14c22400258b14a8b848929da7526fca (patch) | |
tree | 27b0e8064172f59777639e1160fb58181ea2cd8e /bin | |
parent | baac38ed65d7d8a72348311b9e7675555f988d49 (diff) | |
download | chef-zero-ec735cbc14c22400258b14a8b848929da7526fca.tar.gz |
Support daemon mode
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/chef-zero | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/bin/chef-zero b/bin/chef-zero index b6b8a97..25c2364 100755 --- a/bin/chef-zero +++ b/bin/chef-zero @@ -24,6 +24,10 @@ OptionParser.new do |opts| options[:generate_real_keys] = value end + opts.on("-d", "--daemon", "Run as a daemon process") do |value| + options[:daemon] = value + end + opts.on("-l", "--log-level LEVEL", "Set the output log level") do |value| options[:log_level] = value end @@ -40,4 +44,14 @@ OptionParser.new do |opts| end.parse! server = ChefZero::Server.new(options) -server.start(:publish => true) + +if options[:daemon] + unless Process.respond_to?('daemon') + abort 'Process.deamon requires Ruby >= 1.9' + else + Process.daemon(true) + server.start(:publish => true) + end +else + server.start(:publish => true) +end |