ace-eye 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (114) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +38 -0
  3. data/.rspec +2 -0
  4. data/.travis.yml +6 -0
  5. data/CHANGES.md +77 -0
  6. data/Gemfile +6 -0
  7. data/LICENSE +22 -0
  8. data/README.md +212 -0
  9. data/Rakefile +35 -0
  10. data/bin/eye +5 -0
  11. data/bin/loader_eye +72 -0
  12. data/bin/runner +16 -0
  13. data/examples/dependency.eye +17 -0
  14. data/examples/notify.eye +19 -0
  15. data/examples/plugin/README.md +15 -0
  16. data/examples/plugin/main.eye +15 -0
  17. data/examples/plugin/plugin.rb +63 -0
  18. data/examples/process_thin.rb +29 -0
  19. data/examples/processes/em.rb +57 -0
  20. data/examples/processes/forking.rb +20 -0
  21. data/examples/processes/sample.rb +144 -0
  22. data/examples/processes/thin.ru +12 -0
  23. data/examples/puma.eye +29 -0
  24. data/examples/rbenv.eye +11 -0
  25. data/examples/sidekiq.eye +23 -0
  26. data/examples/test.eye +87 -0
  27. data/examples/thin-farm.eye +30 -0
  28. data/examples/unicorn.eye +39 -0
  29. data/eye.gemspec +40 -0
  30. data/lib/eye.rb +28 -0
  31. data/lib/eye/application.rb +73 -0
  32. data/lib/eye/checker.rb +258 -0
  33. data/lib/eye/checker/children_count.rb +44 -0
  34. data/lib/eye/checker/children_memory.rb +12 -0
  35. data/lib/eye/checker/cpu.rb +17 -0
  36. data/lib/eye/checker/cputime.rb +13 -0
  37. data/lib/eye/checker/file_ctime.rb +24 -0
  38. data/lib/eye/checker/file_size.rb +34 -0
  39. data/lib/eye/checker/file_touched.rb +15 -0
  40. data/lib/eye/checker/http.rb +96 -0
  41. data/lib/eye/checker/memory.rb +17 -0
  42. data/lib/eye/checker/nop.rb +6 -0
  43. data/lib/eye/checker/runtime.rb +18 -0
  44. data/lib/eye/checker/socket.rb +159 -0
  45. data/lib/eye/child_process.rb +101 -0
  46. data/lib/eye/cli.rb +185 -0
  47. data/lib/eye/cli/commands.rb +78 -0
  48. data/lib/eye/cli/render.rb +130 -0
  49. data/lib/eye/cli/server.rb +93 -0
  50. data/lib/eye/client.rb +32 -0
  51. data/lib/eye/config.rb +91 -0
  52. data/lib/eye/control.rb +2 -0
  53. data/lib/eye/controller.rb +54 -0
  54. data/lib/eye/controller/commands.rb +88 -0
  55. data/lib/eye/controller/helpers.rb +101 -0
  56. data/lib/eye/controller/load.rb +224 -0
  57. data/lib/eye/controller/options.rb +18 -0
  58. data/lib/eye/controller/send_command.rb +177 -0
  59. data/lib/eye/controller/status.rb +72 -0
  60. data/lib/eye/dsl.rb +53 -0
  61. data/lib/eye/dsl/application_opts.rb +39 -0
  62. data/lib/eye/dsl/chain.rb +12 -0
  63. data/lib/eye/dsl/child_process_opts.rb +13 -0
  64. data/lib/eye/dsl/config_opts.rb +55 -0
  65. data/lib/eye/dsl/group_opts.rb +32 -0
  66. data/lib/eye/dsl/helpers.rb +20 -0
  67. data/lib/eye/dsl/main.rb +51 -0
  68. data/lib/eye/dsl/opts.rb +151 -0
  69. data/lib/eye/dsl/process_opts.rb +36 -0
  70. data/lib/eye/dsl/pure_opts.rb +121 -0
  71. data/lib/eye/dsl/validation.rb +88 -0
  72. data/lib/eye/group.rb +140 -0
  73. data/lib/eye/group/chain.rb +81 -0
  74. data/lib/eye/loader.rb +10 -0
  75. data/lib/eye/local.rb +100 -0
  76. data/lib/eye/logger.rb +104 -0
  77. data/lib/eye/notify.rb +118 -0
  78. data/lib/eye/notify/jabber.rb +30 -0
  79. data/lib/eye/notify/mail.rb +48 -0
  80. data/lib/eye/process.rb +85 -0
  81. data/lib/eye/process/children.rb +60 -0
  82. data/lib/eye/process/commands.rb +280 -0
  83. data/lib/eye/process/config.rb +81 -0
  84. data/lib/eye/process/controller.rb +73 -0
  85. data/lib/eye/process/data.rb +78 -0
  86. data/lib/eye/process/monitor.rb +108 -0
  87. data/lib/eye/process/notify.rb +32 -0
  88. data/lib/eye/process/scheduler.rb +82 -0
  89. data/lib/eye/process/states.rb +86 -0
  90. data/lib/eye/process/states_history.rb +66 -0
  91. data/lib/eye/process/system.rb +97 -0
  92. data/lib/eye/process/trigger.rb +34 -0
  93. data/lib/eye/process/validate.rb +33 -0
  94. data/lib/eye/process/watchers.rb +66 -0
  95. data/lib/eye/reason.rb +20 -0
  96. data/lib/eye/server.rb +60 -0
  97. data/lib/eye/sigar.rb +5 -0
  98. data/lib/eye/system.rb +139 -0
  99. data/lib/eye/system_resources.rb +99 -0
  100. data/lib/eye/trigger.rb +136 -0
  101. data/lib/eye/trigger/check_dependency.rb +30 -0
  102. data/lib/eye/trigger/flapping.rb +41 -0
  103. data/lib/eye/trigger/stop_children.rb +17 -0
  104. data/lib/eye/trigger/transition.rb +15 -0
  105. data/lib/eye/trigger/wait_dependency.rb +49 -0
  106. data/lib/eye/utils.rb +45 -0
  107. data/lib/eye/utils/alive_array.rb +57 -0
  108. data/lib/eye/utils/celluloid_chain.rb +71 -0
  109. data/lib/eye/utils/celluloid_klass.rb +5 -0
  110. data/lib/eye/utils/leak_19.rb +10 -0
  111. data/lib/eye/utils/mini_active_support.rb +111 -0
  112. data/lib/eye/utils/pmap.rb +7 -0
  113. data/lib/eye/utils/tail.rb +20 -0
  114. metadata +398 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 28f2593f564d0f10e2aca2ac677bede964794aff
4
+ data.tar.gz: c9aac8d8d93ee174141d2b3292d50cd30ba1a16d
5
+ SHA512:
6
+ metadata.gz: a94d9b17fd4bf07140f6987d2fe0d35dbbd47410cade372fa3123a933854bce0a064fb8da01605bb63d0f0575851dba09b871c999f2395588b9a7f4f2ab3e6ea
7
+ data.tar.gz: b73463f12782852238b4db8f2473a86254e3cd7053f3697c4fc5cdebc0fe2bc1560cd20c29654500778853826373c1e089f4f6802229ac3e80bbe9934d87e7ed
@@ -0,0 +1,38 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .ruby-version
6
+ .ruby-gemset
7
+ .yardoc
8
+ Gemfile.lock
9
+ InstalledFiles
10
+ _yardoc
11
+ coverage
12
+ doc/
13
+ lib/bundler/man
14
+ pkg
15
+ rdoc
16
+ spec/reports
17
+ test/tmp
18
+ test/version_tmp
19
+ tmp
20
+ *.pid
21
+ *.log
22
+ *.swp
23
+ *~
24
+ TODO
25
+ .todo
26
+ *.png
27
+ *.lock
28
+ experiments
29
+ .git2
30
+ *.stop
31
+ *sublime*
32
+ examples/work*.eye
33
+ script
34
+ [0-9].rb
35
+ *.cache
36
+ *.tmp
37
+ /vendor/
38
+ *.gz
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --format progress
@@ -0,0 +1,6 @@
1
+ language: ruby
2
+ rvm:
3
+ - "1.9.3"
4
+ - "2.0.0"
5
+ - "2.1"
6
+ script: bundle exec rake N=15
@@ -0,0 +1,77 @@
1
+ 0.6
2
+ ------
3
+ * add processes dependencies (#43)
4
+ * add eye-http gem (https://github.com/kostya/eye-http)
5
+ * add eye plugin example (https://github.com/kostya/eye/tree/master/examples/plugin)
6
+ * add quit option --stop_all (#39)
7
+ * add local eye runner (like foreman, used Eyefile)
8
+ * add use_leaf_child monitoring strategy (to daemonize sh -c '...') (788488a)
9
+ * add children_count, children_memory checks
10
+ * add dsl default application options (__default__)
11
+ * trusting external pid_file changes (#52)
12
+
13
+ 0.5.2
14
+ -----
15
+ * rename dsl :childs_update_period to :children_update_period
16
+ * grammar fixes
17
+ * add checker option `above`
18
+
19
+ 0.5.1
20
+ -----
21
+ * fix ordering in info (#27)
22
+ * add log rotation (#26)
23
+ * minor load fixes
24
+
25
+ 0.5
26
+ -------
27
+ * little fixes in dsl
28
+ * remove activesupport dependency
29
+ * rename `state` trigger to `transition`
30
+ * add runtime, cputime, file_touched checks
31
+ * real cpu check (#9)
32
+ * use sigar gem instead of `ps ax`
33
+ * refactor cli (requires `eye q && eye l` after update gem from 0.4.x)
34
+ * update celluloid to 0.15
35
+
36
+ 0.4.2
37
+ -----
38
+ * add checker options :initial_grace, :skip_initial_fails
39
+ * allow deleting env variables (#15)
40
+
41
+ 0.4.1
42
+ ---------
43
+ * add nop checker for periodic restart
44
+ * catch errors in custom checkers, triggers
45
+ * add custom notify
46
+ * checker can fires array of commands
47
+ * fix targets matching
48
+ * remove autoset PWD env
49
+
50
+ 0.4
51
+ ---------
52
+ * pass tests on 1.9.2
53
+ * relax activesupport dependency
54
+ * change client-server protocol (requires `eye q && eye l` after update gem from 0.3.x)
55
+ * not matching targets from different applications
56
+ * improve triggers (custom, better flapping)
57
+ * delete pid_file on crash for daemonize process
58
+ * delete pid_file on stop for all process types (`clear_pid false` to disable)
59
+ * parallel tests (from 30 mins to 3min)
60
+ * update celluloid to 0.14
61
+
62
+ 0.3.2
63
+ ---------
64
+ * improve matching targers
65
+ * possibility to add many checkers with the same type per process (ex: checks :http_2, ...)
66
+ * add uid, gid options (only for ruby 2.0)
67
+
68
+ 0.3.1
69
+ -----
70
+ * load multiple configs (folder,...) now not breaks on first error (each config loads separately)
71
+ * load ~/.eyeconfig with first eye load
72
+ * some concurrency fixes
73
+ * custom checker
74
+
75
+ 0.3
76
+ ---
77
+ * stable version
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in eye.gemspec
4
+ gemspec
5
+
6
+ gem 'parallel_tests', :git => "https://github.com/kostya/parallel_tests.git"
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012-2014 'Konstantin Makarchev'
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,212 @@
1
+ Eye
2
+ ===
3
+ [![Gem Version](https://badge.fury.io/rb/eye.png)](http://rubygems.org/gems/eye)
4
+ [![Build Status](https://secure.travis-ci.org/kostya/eye.png?branch=master)](http://travis-ci.org/kostya/eye)
5
+ [![Coverage Status](https://coveralls.io/repos/kostya/eye/badge.png?branch=master)](https://coveralls.io/r/kostya/eye?branch=master)
6
+
7
+ Process monitoring tool. Inspired from Bluepill and God. Requires Ruby(MRI) >= 1.9.3-p194. Uses Celluloid and Celluloid::IO.
8
+
9
+ Little demo, shows general commands and how chain works:
10
+
11
+ [![Eye](https://raw.github.com/kostya/stuff/master/eye/eye.png)](https://raw.github.com/kostya/stuff/master/eye/eye.gif)
12
+
13
+ Recommended installation on the server (system wide):
14
+
15
+ $ sudo /usr/local/ruby/1.9.3/bin/gem install eye
16
+ $ sudo ln -sf /usr/local/ruby/1.9.3/bin/eye /usr/local/bin/eye
17
+
18
+
19
+ ### Why?
20
+
21
+ We have used god and bluepill in production and always ran into bugs (segfaults, crashes, lost processes, kill not-related processes, load problems, deploy problems, ...)
22
+
23
+ We wanted something more robust and production stable.
24
+
25
+ We wanted the features of bluepill and god, with a few extras like chains, nested configuring, mask matching, easy debug configs
26
+
27
+ I hope we've success, we're using eye in production and are quite happy.
28
+
29
+ ### Config example
30
+
31
+ examples/test.eye
32
+ ```ruby
33
+ # load submodules, here just for example
34
+ Eye.load('./eye/*.rb')
35
+
36
+ # Eye self-configuration section
37
+ Eye.config do
38
+ logger '/tmp/eye.log'
39
+ end
40
+
41
+ # Adding application
42
+ Eye.application 'test' do
43
+ # All options inherits down to the config leafs.
44
+ # except `env`, which merging down
45
+
46
+ working_dir File.expand_path(File.join(File.dirname(__FILE__), %w[ processes ]))
47
+ stdall 'trash.log' # stdout,err logs for processes by default
48
+ env 'APP_ENV' => 'production' # global env for each processes
49
+ trigger :flapping, times: 10, within: 1.minute, retry_in: 10.minutes
50
+ check :cpu, every: 10.seconds, below: 100, times: 3 # global check for all processes
51
+
52
+ group 'samples' do
53
+ chain grace: 5.seconds # chained start-restart with 5s interval, one by one.
54
+
55
+ # eye daemonized process
56
+ process :sample1 do
57
+ pid_file '1.pid' # pid_path will be expanded with the working_dir
58
+ start_command 'ruby ./sample.rb'
59
+
60
+ # when no stop_command or stop_signals, default stop is [:TERM, 0.5, :KILL]
61
+ # default `restart` command is `stop; start`
62
+
63
+ daemonize true
64
+ stdall 'sample1.log'
65
+
66
+ # ensure the CPU is below 30% at least 3 out of the last 5 times checked
67
+ check :cpu, below: 30, times: [3, 5]
68
+ end
69
+
70
+ # self daemonized process
71
+ process :sample2 do
72
+ pid_file '2.pid'
73
+ start_command 'ruby ./sample.rb -d --pid 2.pid --log sample2.log'
74
+ stop_command 'kill -9 {PID}'
75
+
76
+ # ensure the memory is below 300Mb the last 3 times checked
77
+ check :memory, every: 20.seconds, below: 300.megabytes, times: 3
78
+ end
79
+ end
80
+
81
+ # daemon with 3 children
82
+ process :forking do
83
+ pid_file 'forking.pid'
84
+ start_command 'ruby ./forking.rb start'
85
+ stop_command 'ruby forking.rb stop'
86
+ stdall 'forking.log'
87
+
88
+ start_timeout 10.seconds
89
+ stop_timeout 5.seconds
90
+
91
+ monitor_children do
92
+ restart_command 'kill -2 {PID}' # for this child process
93
+ check :memory, below: 300.megabytes, times: 3
94
+ end
95
+ end
96
+
97
+ # eventmachine process, daemonized with eye
98
+ process :event_machine do |p|
99
+ pid_file 'em.pid'
100
+ start_command 'ruby em.rb'
101
+ stdout 'em.log'
102
+ daemonize true
103
+ stop_signals [:QUIT, 2.seconds, :KILL]
104
+
105
+ check :socket, addr: 'tcp://127.0.0.1:33221', every: 10.seconds, times: 2,
106
+ timeout: 1.second, send_data: 'ping', expect_data: /pong/
107
+ end
108
+
109
+ # thin process, self daemonized
110
+ process :thin do
111
+ pid_file 'thin.pid'
112
+ start_command 'bundle exec thin start -R thin.ru -p 33233 -d -l thin.log -P thin.pid'
113
+ stop_signals [:QUIT, 2.seconds, :TERM, 1.seconds, :KILL]
114
+
115
+ check :http, url: 'http://127.0.0.1:33233/hello', pattern: /World/,
116
+ every: 5.seconds, times: [2, 3], timeout: 1.second
117
+ end
118
+
119
+ end
120
+ ```
121
+
122
+ ### Start eye daemon and/or load config:
123
+
124
+ $ eye l(oad) examples/test.eye
125
+
126
+ load folder with configs:
127
+
128
+ $ eye l examples/
129
+ $ eye l examples/*.rb
130
+
131
+ foreground load:
132
+
133
+ $ eye l CONF -f
134
+
135
+ If the eye daemon has already started and you call the `load` command, the config will be updated (into eye daemon). New objects(applications, groups, processes) will be added and monitored. Processes removed from the config will be removed (and stopped if the process has `stop_on_delete true`). Other objects will update their configs.
136
+
137
+
138
+ Process statuses:
139
+
140
+ $ eye i(nfo)
141
+
142
+ ```
143
+ test
144
+ samples
145
+ sample1 ....................... up (21:52, 0%, 13Mb, <4107>)
146
+ sample2 ....................... up (21:52, 0%, 12Mb, <4142>)
147
+ event_machine ................... up (21:52, 3%, 26Mb, <4112>)
148
+ forking ......................... up (21:52, 0%, 41Mb, <4203>)
149
+ child-4206 .................... up (21:52, 0%, 41Mb, <4206>)
150
+ child-4211 .................... up (21:52, 0%, 41Mb, <4211>)
151
+ child-4214 .................... up (21:52, 0%, 41Mb, <4214>)
152
+ thin ............................ up (21:53, 2%, 54Mb, <4228>)
153
+ ```
154
+
155
+ ### Commands:
156
+
157
+ start, stop, restart, delete, monitor, unmonitor
158
+
159
+ Command params (with restart for example):
160
+
161
+ $ eye r(estart) all
162
+ $ eye r test
163
+ $ eye r samples
164
+ $ eye r sample1
165
+ $ eye r sample*
166
+ $ eye r test:samples
167
+ $ eye r test:samples:sample1
168
+ $ eye r test:samples:sample*
169
+ $ eye r test:*sample*
170
+
171
+ Check config syntax:
172
+
173
+ $ eye c(heck) examples/test.eye
174
+
175
+ Config explain (for debug):
176
+
177
+ $ eye e(xplain) examples/test.eye
178
+
179
+ Log tracing (tail and grep):
180
+
181
+ $ eye t(race)
182
+ $ eye t test
183
+ $ eye t sample
184
+
185
+ Quit monitoring:
186
+
187
+ $ eye q(uit)
188
+ $ eye q -s # stop all processes and quit
189
+
190
+ Interactive info:
191
+
192
+ $ eye w(atch)
193
+
194
+ Process statuses history:
195
+
196
+ $ eye hi(story)
197
+
198
+ Eye daemon info:
199
+
200
+ $ eye x(info)
201
+ $ eye x -c # for show current config
202
+
203
+ Process states and events:
204
+
205
+ [![Eye](https://raw.github.com/kostya/stuff/master/eye/mprocess.png)](https://raw.github.com/kostya/stuff/master/eye/process.png)
206
+
207
+
208
+ EyeHttp Gem:
209
+
210
+ https://github.com/kostya/eye-http
211
+
212
+ Thanks `Bluepill` for the nice config ideas.
@@ -0,0 +1,35 @@
1
+ #!/usr/bin/env rake
2
+
3
+ require "bundler/gem_tasks"
4
+ require 'rspec/core/rake_task'
5
+ require 'parallel_tests/tasks'
6
+ require 'coveralls/rake/task'
7
+
8
+ Coveralls::RakeTask.new
9
+
10
+ task :default => :pspec
11
+
12
+ task :pspec do
13
+ Rake::Task['parallel:spec'].invoke(ENV['N'] || 10)
14
+ end
15
+
16
+ RSpec::Core::RakeTask.new(:spec) do |t|
17
+ t.verbose = false
18
+ end
19
+
20
+ task :remove_coverage do
21
+ require 'fileutils'
22
+ FileUtils.rm_rf(File.expand_path(File.join(File.dirname(__FILE__), %w{ coverage })))
23
+ end
24
+
25
+ task :env do
26
+ require 'bundler/setup'
27
+ require 'eye'
28
+ Eye::Controller
29
+ Eye::Process
30
+ end
31
+
32
+ desc "graph"
33
+ task :graph => :env do
34
+ StateMachine::Machine.draw("Eye::Process")
35
+ end
data/bin/eye ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+ $:.unshift File.expand_path(File.join(File.dirname(__FILE__), %w[.. lib]))
3
+ require 'eye'
4
+
5
+ Eye::Cli.start
@@ -0,0 +1,72 @@
1
+ #!/usr/bin/env ruby
2
+ $:.unshift File.expand_path(File.join(File.dirname(__FILE__), %w[.. lib]))
3
+ require 'eye/loader'
4
+ require 'optparse'
5
+ require 'eye'
6
+
7
+ options = {:debug => false}
8
+
9
+ OptionParser.new do |opts|
10
+ opts.on( '-h', '--help', 'Display this screen' ) do
11
+ puts opts
12
+ exit
13
+ end
14
+
15
+ opts.on( '-c', '--config CONFIG', 'load with config' ) do |config_path|
16
+ options[:config] = config_path
17
+ end
18
+
19
+ opts.on( '-s', '--socket SOCKET', 'start listen on socket' ) do |socket_path|
20
+ options[:socket_path] = socket_path
21
+ end
22
+
23
+ opts.on( '-l', '--logger LOGGER', 'custom logger' ) do |logger|
24
+ options[:logger] = logger
25
+ end
26
+
27
+ opts.on( '-dr', '--dir DIR', 'Dir for local runner' ) do |dir|
28
+ Eye::Local.dir = dir
29
+ Eye::Local.local_runner = true
30
+ end
31
+
32
+ opts.on( '-st', '--stop_all', 'Stop all on exit' ) do |stop_all|
33
+ options[:stop_all] = true
34
+ end
35
+
36
+ opts.on( '-d', '--debug', 'debug info to logger' ) do
37
+ options[:debug] = true
38
+ end
39
+
40
+ end.parse!
41
+
42
+ Eye::Local.ensure_eye_dir
43
+
44
+ socket_path = options[:socket_path] || Eye::Local.socket_path
45
+ server = Eye::Server.new(socket_path)
46
+
47
+ Eye::Logger.log_level = options[:debug] ? Logger::DEBUG : Logger::INFO
48
+ Eye::Logger.link_logger(options[:logger]) if options[:logger]
49
+
50
+ config = options[:config]
51
+ config = File.expand_path(config) if config && !config.empty?
52
+
53
+ Eye::Control # preload
54
+
55
+ if config
56
+ res = server.command('load', config)
57
+ exit if res.values.any? { |r| r[:error] }
58
+ end
59
+
60
+ Eye::Control.set_proc_line
61
+
62
+ server.async.run
63
+
64
+ trap("USR1") { Eye::Logger.reopen }
65
+ trap("USR2") { GC.start }
66
+ trap("INT") { Eye::Logger.info("INT signal <#{$$}>"); exit }
67
+ trap("QUIT") { Eye::Logger.info("QUIT signal <#{$$}>"); exit }
68
+ trap("TERM") { Eye::Logger.info("TERM signal <#{$$}>"); exit }
69
+
70
+ at_exit { Eye::Control.command(:stop_all) } if options[:stop_all]
71
+
72
+ sleep