def start_service
if Win32::Service.exists?(@new_resource.service_name)
if current_state == RUNNING
Chef::Log.debug "#{@new_resource} already started - nothing to do"
else
if @new_resource.start_command
Chef::Log.debug "#{@new_resource} starting service using the given start_command"
shell_out!(@new_resource.start_command)
else
spawn_command_thread do
Win32::Service.start(@new_resource.service_name)
wait_for_state(RUNNING)
end
end
@new_resource.updated_by_last_action(true)
end
else
Chef::Log.debug "#{@new_resource} does not exist - nothing to do"
end
end