Skip to content

Instantly share code, notes, and snippets.

@flazz
Created May 15, 2009 14:57
Show Gist options
  • Save flazz/112243 to your computer and use it in GitHub Desktop.
Save flazz/112243 to your computer and use it in GitHub Desktop.
#!/usr/bin/ruby
LOG_DIR = "/var/log/daitss/ingest" || ENV['DAITSS_INGEST_LOG_DIR']
Dir.chdir LOG_DIR do
last_file = `ls -tr #{LOG_DIR} | tail -n 1`.chomp
open last_file do |io_potential|
loop do
a = select [io_potential], nil, nil, 1.5
if a
io = a[0][0]
print io.read
else
puts 'nothing to read' # i never get here
break
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment