V
Venkat Venkataraju
Hi All
I'm trying to write a ruby program that will constantly read a open
pipe, line by line and then log it onto another file. but when i try to
run this script with an & at the end, the program stops as soon as it
starts.
here is the listing of the code. if the script is run normaly without
any & in the end, it works.
#! /usr/bin/env ruby
# loop.rb: infinite loop program
ostream = File.new("junk.log", "w")
pipe = IO.popen("top");
if $0 == __FILE__
while true
ostream.puts(pipe.readline)
ostream.flush
sleep(1)
end
end
I know that the reason for teh termination of the code has to do
somethign with the pipe. is this a normal behavior?
i would like to execute this code without depending on the console. is
it possible to do so? or if not, is there any other solution?
Thanks
Venkat
I'm trying to write a ruby program that will constantly read a open
pipe, line by line and then log it onto another file. but when i try to
run this script with an & at the end, the program stops as soon as it
starts.
here is the listing of the code. if the script is run normaly without
any & in the end, it works.
#! /usr/bin/env ruby
# loop.rb: infinite loop program
ostream = File.new("junk.log", "w")
pipe = IO.popen("top");
if $0 == __FILE__
while true
ostream.puts(pipe.readline)
ostream.flush
sleep(1)
end
end
I know that the reason for teh termination of the code has to do
somethign with the pipe. is this a normal behavior?
i would like to execute this code without depending on the console. is
it possible to do so? or if not, is there any other solution?
Thanks
Venkat