summaryrefslogtreecommitdiff
path: root/chef/bin/chef-client
diff options
context:
space:
mode:
authorAdam Jacob <adam@hjksolutions.com>2009-04-29 15:13:45 -0700
committerAdam Jacob <adam@hjksolutions.com>2009-04-29 15:13:45 -0700
commit7ebaaa462c63d7b5a36b47b0c13a013c0d6d7bec (patch)
tree0692206a3da19eb7eba119bfdb80433da0821fd7 /chef/bin/chef-client
parent98831d379562b84c2fb68e091ef6cfb711efe84b (diff)
parent5ad81e5cf7a81330fd475e396cb1ebe7f1b26b2b (diff)
downloadchef-7ebaaa462c63d7b5a36b47b0c13a013c0d6d7bec.tar.gz
Merge branch 'master' into dbalatero/chef-258
Diffstat (limited to 'chef/bin/chef-client')
-rwxr-xr-xchef/bin/chef-client9
1 files changed, 6 insertions, 3 deletions
diff --git a/chef/bin/chef-client b/chef/bin/chef-client
index f960794c5d..84845edfff 100755
--- a/chef/bin/chef-client
+++ b/chef/bin/chef-client
@@ -85,12 +85,15 @@ Chef::Daemon.change_privilege
Chef::Log.init(Chef::Config[:log_location])
Chef::Log.level(Chef::Config[:log_level])
-Chef::Config[:delay] = 0
+Chef::Config[:delay] = 0
if Chef::Config[:daemonize]
# We want to set the interval to half an hour, if one is not set.
Chef::Config[:interval] ||= 1800
Chef::Daemon.daemonize("chef-client")
+end
+
+if Chef::Config[:interval]
Chef::Config[:delay] = Chef::Config[:interval].to_i + (Chef::Config[:splay] ? rand(Chef::Config[:splay]) : 0)
end
@@ -101,7 +104,7 @@ loop do
c.validation_token = Chef::Config[:validation_token]
c.node_name = Chef::Config[:node_name]
c.run
- if Chef::Config[:daemonize]
+ if Chef::Config[:interval]
Chef::Log.debug("Sleeping for #{Chef::Config[:delay]} seconds")
sleep Chef::Config[:delay]
else
@@ -110,7 +113,7 @@ loop do
rescue SystemExit => e
raise
rescue Exception => e
- if Chef::Config[:daemonize]
+ if Chef::Config[:interval]
Chef::Log.error("#{e.class}")
Chef::Log.fatal("#{e}\n#{e.backtrace.join("\n")}")
Chef::Log.fatal("Sleeping for #{Chef::Config[:delay]} seconds before trying again")