15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
# File 'lib/librr/runner.rb', line 15
def run!
self.clear_pid
@stoping = false
EventMachine.run do
trap("SIGINT") do
return if @stoping
@stoping = true
EM.stop
self.info "eventmachine stopping.."
self.clear_pid
end
indexer = Librr::Indexer.new
monitor = Librr::DirMonitor.new
server = Librr::CmdServer.new
monitor.init(indexer: indexer)
server.init(indexer: indexer, monitor: monitor)
indexer.start do
monitor.start do
server.start do
self.info "daemon started"
self.write_pid
end
end
end
end
self.info "eventmachine stopped."
end
|