Created
August 9, 2011 14:59
-
-
Save modeverv/1134278 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! ruby | |
# -*- coding: utf-8 -*- | |
require "/Users/seijiro/code/ruby/my-lib.rb" | |
class ThisDo < MyObject | |
include RunPerSecModule | |
include MyDBModule | |
include MyPusherModule | |
def initialize | |
@f = open(ARGV[0]||"/var/log/system.log") | |
while @f.gets | |
end | |
@count = 1 #ループ制御 | |
end | |
def main_loop | |
data = "" | |
while @f.gets | |
data << $_ | |
print $_ | |
end | |
kick(data) if data !="" | |
@count = @count + 1 | |
puts @count | |
stop_run if @count > 10 | |
end | |
def kick(data) | |
data = data.toutf8.gsub("\n","<br>") | |
insert_DB("my_app_tail",data) | |
push_pusher('my_app_tail',data) | |
end | |
end | |
instance = ThisDo.new | |
instance.run(1) do | |
puts "check" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment