Current Path : /compat/linux/proc/self/root/usr/local/share/examples/ruby18/drb/ |
FreeBSD hs32.drive.ne.jp 9.1-RELEASE FreeBSD 9.1-RELEASE #1: Wed Jan 14 12:18:08 JST 2015 root@hs32.drive.ne.jp:/sys/amd64/compile/hs32 amd64 |
Current File : //compat/linux/proc/self/root/usr/local/share/examples/ruby18/drb/dbiff.rb |
# # dbiff.rb - distributed cdbiff (server) # * original: cdbiff by Satoru Takabayashi <http://namazu.org/~satoru/cdbiff> require 'drb/drb' require 'drb/eq' require 'drb/observer' class Biff include DRb::DRbObservable def initialize(filename, interval) super() @filename = filename @interval = interval end def run last = Time.now while true begin sleep(@interval) current = File::mtime(@filename) if current > last changed begin notify_observers(@filename, current) rescue Error end last = current end rescue next end end end end def main filename = "/var/mail/#{ENV['USER']}" interval = 15 uri = 'druby://:19903' biff = Biff.new(filename, interval) DRb.start_service(uri, biff) biff.run end main