[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

running ab command in cron

Zakir Zakir

7/28/2008 5:06:00 PM

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?
--
Posted via http://www.ruby-....

2 Answers

ara.t.howard

7/28/2008 6:01:00 PM

0


On Jul 28, 2008, at 11:06 AM, Zakir Zakir wrote:

> 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?
> --


maybe the full path to ab - cron does not have your environment.

a @ http://codeforp...
--
we can deny everything, except that we have the possibility of being
better. simply reflect on that.
h.h. the 14th dalai lama




Zakir Zakir

7/29/2008 3:35:00 AM

0

>
> maybe the full path to ab - cron does not have your environment.
>
yap worked like charm. thankx

--
Posted via http://www.ruby-....