summaryrefslogtreecommitdiff
path: root/ext/windows/service/daemon.rb
diff options
context:
space:
mode:
Diffstat (limited to 'ext/windows/service/daemon.rb')
-rwxr-xr-xext/windows/service/daemon.rb19
1 files changed, 9 insertions, 10 deletions
diff --git a/ext/windows/service/daemon.rb b/ext/windows/service/daemon.rb
index 3f05ee95f..84e4a283d 100755
--- a/ext/windows/service/daemon.rb
+++ b/ext/windows/service/daemon.rb
@@ -54,18 +54,16 @@ class WindowsDaemon < Win32::Daemon
# )
# end
- log_notice("Starting service with arguments: #{args}")
+ puppet = File.join(basedir, 'bin', 'puppet.bat')
+ unless File.exists?(puppet)
+ log_err("File not found: '#{puppet}'")
+ return
+ end
+ log_debug("Using '#{puppet}'")
- while running? do
- log_notice('Service running')
+ log_notice('Service started')
- puppet = File.join(basedir, 'bin', 'puppet.bat')
- unless File.exists?(puppet)
- log_err("File not found: '#{puppet}'")
- return
- end
-
- log_debug("Using '#{puppet}'")
+ while running? do
begin
runinterval = %x{ "#{puppet}" agent --configprint runinterval }.to_i
if runinterval == 0
@@ -78,6 +76,7 @@ class WindowsDaemon < Win32::Daemon
end
if state == RUNNING or state == IDLE
+ log_notice("Executing agent with arguments: #{args}")
pid = Process.create(:command_line => "\"#{puppet}\" agent --onetime #{args}", :creation_flags => Process::CREATE_NEW_CONSOLE).process_id
log_debug("Process created: #{pid}")
else