running ab command in cron

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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top