D
Derek Smith
Hi All,
I have posted the same code b4, but could not find my original post,
however this is a different question. I am a newb, so here I go.
Thank you!
This is my error:
$ ruby test.rb
test.rb:46: undefined method `flock' for main:Object (NoMethodError)
from test.rb:45:in `open'
from test.rb:45
from test.rb:42:in `each'
from test.rb:42
Here is my code:
#!/usr/bin/ruby -w
require 'ftools'
array1 = Dir.glob("*.log")
if ( array1.length >= 1 )
array1.each { |file|
File.copy(file, "#{file}.orig")
if (File.size?(file) > FSIZE)
File.open(file, 'r+') do |f|
flock(f, File::LOCK_SH) do |f|
f << "i got a lock"
end
end
end
}
else
raise StandardError, "Array 'array1' has no values, logs will not be
rolled!"
end
I have posted the same code b4, but could not find my original post,
however this is a different question. I am a newb, so here I go.
Thank you!
This is my error:
$ ruby test.rb
test.rb:46: undefined method `flock' for main:Object (NoMethodError)
from test.rb:45:in `open'
from test.rb:45
from test.rb:42:in `each'
from test.rb:42
Here is my code:
#!/usr/bin/ruby -w
require 'ftools'
array1 = Dir.glob("*.log")
if ( array1.length >= 1 )
array1.each { |file|
File.copy(file, "#{file}.orig")
if (File.size?(file) > FSIZE)
File.open(file, 'r+') do |f|
flock(f, File::LOCK_SH) do |f|
f << "i got a lock"
end
end
end
}
else
raise StandardError, "Array 'array1' has no values, logs will not be
rolled!"
end