Z
Zakir Zakir
def get_web_performance(instance_url)
web_performance = -111
ab_command = "ab -n 1000 -c 5 -d -S -k http://" + instance_url +
"/dbcon/index.php:80/ "
puts ab_command
result = IO.popen(ab_command)
puts result
pipe = result.readlines
pipe.each do |line|
puts line
if line =~ /^apr_socket_recv/
#puts 111
break
end
if line =~ /^Time per request:/
#puts line
stats = line.split
#puts stats[3]
web_performance = stats[3].to_i
puts web_performance
break
end
#puts line
end
return web_performance
end
if i run this code in shell. it works fine. when i run the ruby script
with cron i dont get any output of this line IO.popen(ab_command). is
there any thing i am missing?
web_performance = -111
ab_command = "ab -n 1000 -c 5 -d -S -k http://" + instance_url +
"/dbcon/index.php:80/ "
puts ab_command
result = IO.popen(ab_command)
puts result
pipe = result.readlines
pipe.each do |line|
puts line
if line =~ /^apr_socket_recv/
#puts 111
break
end
if line =~ /^Time per request:/
#puts line
stats = line.split
#puts stats[3]
web_performance = stats[3].to_i
puts web_performance
break
end
#puts line
end
return web_performance
end
if i run this code in shell. it works fine. when i run the ruby script
with cron i dont get any output of this line IO.popen(ab_command). is
there any thing i am missing?