def start_service
begin
if @new_resource.start_command
popen4(@new_resource.start_command) do |pid, stdin, stdout, stderr|
Chef::Log.debug stdout.readlines
end
else
popen4("#{@init_command} start #{@new_resource.service_name}") do |pid, stdin, stdout, stderr|
output = stdout.readlines
Chef::Log.debug output.join
output.join =~ /RUNNING/ || output.join =~ /START_PENDING/ ? true : false
end
end
rescue Exception => e
raise Chef::Exceptions::Service, "Failed to start service #{@new_resource.service_name}: #{e.message}"
end
end