eye 0.1.11
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +31 -0
- data/.rspec +2 -0
- data/Gemfile +4 -0
- data/LICENSE +22 -0
- data/README.md +132 -0
- data/Rakefile +18 -0
- data/bin/eye +282 -0
- data/bin/loader_eye +56 -0
- data/examples/processes/em.rb +56 -0
- data/examples/processes/forking.rb +20 -0
- data/examples/processes/sample.rb +144 -0
- data/examples/rbenv.eye +11 -0
- data/examples/test.eye +65 -0
- data/examples/unicorn.eye +29 -0
- data/eye.gemspec +37 -0
- data/lib/eye.rb +25 -0
- data/lib/eye/application.rb +65 -0
- data/lib/eye/checker.rb +118 -0
- data/lib/eye/checker/cpu.rb +27 -0
- data/lib/eye/checker/file_ctime.rb +29 -0
- data/lib/eye/checker/file_size.rb +38 -0
- data/lib/eye/checker/http.rb +94 -0
- data/lib/eye/checker/memory.rb +27 -0
- data/lib/eye/checker/socket.rb +148 -0
- data/lib/eye/checker/validation.rb +49 -0
- data/lib/eye/child_process.rb +75 -0
- data/lib/eye/client.rb +32 -0
- data/lib/eye/control.rb +2 -0
- data/lib/eye/controller.rb +43 -0
- data/lib/eye/controller/commands.rb +64 -0
- data/lib/eye/controller/helpers.rb +61 -0
- data/lib/eye/controller/load.rb +224 -0
- data/lib/eye/controller/send_command.rb +88 -0
- data/lib/eye/controller/status.rb +136 -0
- data/lib/eye/dsl.rb +52 -0
- data/lib/eye/dsl/application_opts.rb +33 -0
- data/lib/eye/dsl/chain.rb +12 -0
- data/lib/eye/dsl/child_process_opts.rb +7 -0
- data/lib/eye/dsl/config_opts.rb +11 -0
- data/lib/eye/dsl/group_opts.rb +27 -0
- data/lib/eye/dsl/helpers.rb +12 -0
- data/lib/eye/dsl/main.rb +58 -0
- data/lib/eye/dsl/opts.rb +88 -0
- data/lib/eye/dsl/process_opts.rb +21 -0
- data/lib/eye/dsl/pure_opts.rb +132 -0
- data/lib/eye/dsl/validate.rb +41 -0
- data/lib/eye/group.rb +125 -0
- data/lib/eye/group/chain.rb +68 -0
- data/lib/eye/io/unix_server.rb +44 -0
- data/lib/eye/io/unix_socket.rb +39 -0
- data/lib/eye/loader.rb +13 -0
- data/lib/eye/logger.rb +80 -0
- data/lib/eye/process.rb +83 -0
- data/lib/eye/process/child.rb +61 -0
- data/lib/eye/process/commands.rb +256 -0
- data/lib/eye/process/config.rb +70 -0
- data/lib/eye/process/controller.rb +72 -0
- data/lib/eye/process/data.rb +46 -0
- data/lib/eye/process/monitor.rb +97 -0
- data/lib/eye/process/notify.rb +17 -0
- data/lib/eye/process/scheduler.rb +50 -0
- data/lib/eye/process/states.rb +92 -0
- data/lib/eye/process/states_history.rb +62 -0
- data/lib/eye/process/system.rb +60 -0
- data/lib/eye/process/trigger.rb +32 -0
- data/lib/eye/process/watchers.rb +67 -0
- data/lib/eye/server.rb +51 -0
- data/lib/eye/settings.rb +35 -0
- data/lib/eye/system.rb +145 -0
- data/lib/eye/system_resources.rb +83 -0
- data/lib/eye/trigger.rb +53 -0
- data/lib/eye/trigger/flapping.rb +24 -0
- data/lib/eye/utils.rb +5 -0
- data/lib/eye/utils/alive_array.rb +31 -0
- data/lib/eye/utils/celluloid_chain.rb +51 -0
- data/lib/eye/utils/leak_19.rb +7 -0
- data/lib/eye/utils/tail.rb +20 -0
- data/spec/checker/cpu_spec.rb +58 -0
- data/spec/checker/file_ctime_spec.rb +34 -0
- data/spec/checker/file_size_spec.rb +107 -0
- data/spec/checker/http_spec.rb +109 -0
- data/spec/checker/memory_spec.rb +64 -0
- data/spec/checker/socket_spec.rb +116 -0
- data/spec/checker_spec.rb +188 -0
- data/spec/child_process/child_process_spec.rb +46 -0
- data/spec/client_server_spec.rb +34 -0
- data/spec/controller/commands_spec.rb +92 -0
- data/spec/controller/controller_spec.rb +133 -0
- data/spec/controller/find_objects_spec.rb +150 -0
- data/spec/controller/group_spec.rb +110 -0
- data/spec/controller/intergration_spec.rb +327 -0
- data/spec/controller/load_spec.rb +326 -0
- data/spec/controller/races_spec.rb +70 -0
- data/spec/controller/stop_on_delete_spec.rb +157 -0
- data/spec/dsl/chain_spec.rb +140 -0
- data/spec/dsl/checks_spec.rb +202 -0
- data/spec/dsl/config_spec.rb +44 -0
- data/spec/dsl/dsl_spec.rb +73 -0
- data/spec/dsl/getter_spec.rb +223 -0
- data/spec/dsl/integration_spec.rb +311 -0
- data/spec/dsl/load_spec.rb +52 -0
- data/spec/dsl/process_spec.rb +330 -0
- data/spec/dsl/sub_procs_spec.rb +93 -0
- data/spec/dsl/with_server_spec.rb +104 -0
- data/spec/example/em.rb +57 -0
- data/spec/example/forking.rb +20 -0
- data/spec/example/sample.rb +154 -0
- data/spec/fixtures/dsl/0.rb +8 -0
- data/spec/fixtures/dsl/0a.rb +8 -0
- data/spec/fixtures/dsl/0c.rb +8 -0
- data/spec/fixtures/dsl/1.rb +5 -0
- data/spec/fixtures/dsl/bad.eye +6 -0
- data/spec/fixtures/dsl/configs/1.eye +3 -0
- data/spec/fixtures/dsl/configs/2.eye +1 -0
- data/spec/fixtures/dsl/configs/3.eye +1 -0
- data/spec/fixtures/dsl/configs/4.eye +3 -0
- data/spec/fixtures/dsl/empty.eye +20 -0
- data/spec/fixtures/dsl/include_test.eye +5 -0
- data/spec/fixtures/dsl/include_test/1.rb +6 -0
- data/spec/fixtures/dsl/include_test/ha.rb +4 -0
- data/spec/fixtures/dsl/include_test2.eye +5 -0
- data/spec/fixtures/dsl/integration.eye +30 -0
- data/spec/fixtures/dsl/integration2.eye +32 -0
- data/spec/fixtures/dsl/integration_locks.eye +30 -0
- data/spec/fixtures/dsl/integration_sor.eye +32 -0
- data/spec/fixtures/dsl/integration_sor2.eye +27 -0
- data/spec/fixtures/dsl/integration_sor3.eye +32 -0
- data/spec/fixtures/dsl/load.eye +25 -0
- data/spec/fixtures/dsl/load2.eye +7 -0
- data/spec/fixtures/dsl/load2_dup2.eye +13 -0
- data/spec/fixtures/dsl/load2_dup_pid.eye +7 -0
- data/spec/fixtures/dsl/load3.eye +10 -0
- data/spec/fixtures/dsl/load4.eye +7 -0
- data/spec/fixtures/dsl/load5.eye +8 -0
- data/spec/fixtures/dsl/load6.eye +17 -0
- data/spec/fixtures/dsl/load_dubls.eye +36 -0
- data/spec/fixtures/dsl/load_dup_ex_names.eye +15 -0
- data/spec/fixtures/dsl/load_error.eye +5 -0
- data/spec/fixtures/dsl/load_error_folder/load3.eye +10 -0
- data/spec/fixtures/dsl/load_error_folder/load4.eye +7 -0
- data/spec/fixtures/dsl/load_folder/load3.eye +10 -0
- data/spec/fixtures/dsl/load_folder/load4.eye +7 -0
- data/spec/fixtures/dsl/load_int.eye +8 -0
- data/spec/fixtures/dsl/load_int2.eye +13 -0
- data/spec/fixtures/dsl/load_logger.eye +26 -0
- data/spec/fixtures/dsl/load_logger2.eye +3 -0
- data/spec/fixtures/dsl/long_load.eye +5 -0
- data/spec/fixtures/dsl/subfolder1/proc1.rb +3 -0
- data/spec/fixtures/dsl/subfolder2.eye +9 -0
- data/spec/fixtures/dsl/subfolder2/common.rb +1 -0
- data/spec/fixtures/dsl/subfolder2/proc2.rb +3 -0
- data/spec/fixtures/dsl/subfolder2/sub/proc3.rb +6 -0
- data/spec/fixtures/dsl/subfolder3.eye +8 -0
- data/spec/fixtures/dsl/subfolder3/common.rb +1 -0
- data/spec/fixtures/dsl/subfolder3/proc4.rb +3 -0
- data/spec/fixtures/dsl/subfolder3/sub/proc5.rb +6 -0
- data/spec/fixtures/dsl/subfolder4.eye +6 -0
- data/spec/fixtures/dsl/subfolder4/a.rb +2 -0
- data/spec/fixtures/dsl/subfolder4/b.rb +1 -0
- data/spec/fixtures/dsl/subfolder4/c.rb +1 -0
- data/spec/mock_spec.rb +32 -0
- data/spec/process/checks/child_checks_spec.rb +79 -0
- data/spec/process/checks/cpu_spec.rb +114 -0
- data/spec/process/checks/ctime_spec.rb +43 -0
- data/spec/process/checks/fsize_spec.rb +22 -0
- data/spec/process/checks/http_spec.rb +52 -0
- data/spec/process/checks/intergration_spec.rb +32 -0
- data/spec/process/checks/memory_spec.rb +113 -0
- data/spec/process/child_process_spec.rb +125 -0
- data/spec/process/config_spec.rb +75 -0
- data/spec/process/controller_spec.rb +173 -0
- data/spec/process/monitoring_spec.rb +180 -0
- data/spec/process/restart_spec.rb +174 -0
- data/spec/process/scheduler_spec.rb +150 -0
- data/spec/process/start_spec.rb +261 -0
- data/spec/process/states_history_spec.rb +118 -0
- data/spec/process/stop_spec.rb +150 -0
- data/spec/process/system_spec.rb +100 -0
- data/spec/process/triggers/flapping_spec.rb +81 -0
- data/spec/process/update_config_spec.rb +63 -0
- data/spec/spec_helper.rb +120 -0
- data/spec/support/rr_celluloid.rb +36 -0
- data/spec/support/scheduler_hack.rb +16 -0
- data/spec/support/spec_support.rb +164 -0
- data/spec/system_resources_spec.rb +59 -0
- data/spec/system_spec.rb +170 -0
- data/spec/utils/alive_array_spec.rb +50 -0
- data/spec/utils/celluloid_chain_spec.rb +82 -0
- data/spec/utils/tail_spec.rb +21 -0
- metadata +558 -0
@@ -0,0 +1,104 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../spec_helper'
|
2
|
+
|
3
|
+
describe "with_server feature" do
|
4
|
+
|
5
|
+
it "should load matched by string process" do
|
6
|
+
stub(Eye::System).host{ "server1" }
|
7
|
+
|
8
|
+
conf = <<-E
|
9
|
+
Eye.application("bla") do
|
10
|
+
with_server "server1" do
|
11
|
+
process("1"){ pid_file "1.pid" }
|
12
|
+
end
|
13
|
+
|
14
|
+
with_server "server2" do
|
15
|
+
process("2"){ pid_file "2.pid" }
|
16
|
+
end
|
17
|
+
end
|
18
|
+
E
|
19
|
+
|
20
|
+
Eye::Dsl.parse_apps(conf).should == {"bla"=>{:name => "bla", :groups=>{"__default__"=>{:name => "__default__", :application => "bla", :processes=>{"1"=>{:pid_file=>"1.pid", :application=>"bla", :group=>"__default__", :name=>"1"}}}}}}
|
21
|
+
end
|
22
|
+
|
23
|
+
it "should another host conditions" do
|
24
|
+
stub(Eye::System).host{ "server1" }
|
25
|
+
|
26
|
+
conf = <<-E
|
27
|
+
Eye.application("bla") do
|
28
|
+
with_server %w{server1 server2} do
|
29
|
+
process("1"){ pid_file "1.pid" }
|
30
|
+
|
31
|
+
if Eye::SystemResources == 'server2'
|
32
|
+
process("2"){ pid_file "2.pid" }
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
E
|
37
|
+
|
38
|
+
Eye::Dsl.parse_apps(conf).should == {"bla"=>{:name => "bla", :groups=>{"__default__"=>{:name => "__default__", :application => "bla", :processes=>{"1"=>{:pid_file=>"1.pid", :application=>"bla", :group=>"__default__", :name=>"1"}}}}}}
|
39
|
+
end
|
40
|
+
|
41
|
+
describe "matches" do
|
42
|
+
subject{ Eye::Dsl::Opts.new }
|
43
|
+
|
44
|
+
it "match string" do
|
45
|
+
stub(Eye::System).host{ "server1" }
|
46
|
+
subject.with_server("server1").should == true
|
47
|
+
subject.with_server("server2").should == false
|
48
|
+
subject.with_server('').should == true
|
49
|
+
subject.with_server(nil).should == true
|
50
|
+
end
|
51
|
+
|
52
|
+
it "match array" do
|
53
|
+
stub(Eye::System).host{ "server1" }
|
54
|
+
subject.with_server(%w{ server1 server2}).should == true
|
55
|
+
subject.with_server(%w{ server2 server3}).should == false
|
56
|
+
end
|
57
|
+
|
58
|
+
it "match regexp" do
|
59
|
+
stub(Eye::System).host{ "server1" }
|
60
|
+
subject.with_server(%r{server}).should == true
|
61
|
+
subject.with_server(%r{myserver}).should == false
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
describe "helpers" do
|
66
|
+
it "hostname on with server" do
|
67
|
+
conf = <<-E
|
68
|
+
Eye.application("bla"){
|
69
|
+
with_server('muga_server') do
|
70
|
+
working_dir "/tmp"
|
71
|
+
end
|
72
|
+
}
|
73
|
+
E
|
74
|
+
Eye::Dsl.parse_apps(conf).should == {"bla" => {:name => "bla"}}
|
75
|
+
end
|
76
|
+
|
77
|
+
it "with_server work" do
|
78
|
+
Eye::System.host = 'mega_server'
|
79
|
+
|
80
|
+
conf = <<-E
|
81
|
+
Eye.application("bla"){
|
82
|
+
with_server('mega_server') do
|
83
|
+
working_dir "/tmp"
|
84
|
+
end
|
85
|
+
}
|
86
|
+
E
|
87
|
+
Eye::Dsl.parse_apps(conf).should == {"bla" => {:working_dir=>"/tmp", :name => "bla"}}
|
88
|
+
end
|
89
|
+
|
90
|
+
it "hostname work" do
|
91
|
+
Eye::System.host = 'supa_server'
|
92
|
+
|
93
|
+
conf = <<-E
|
94
|
+
Eye.application("bla"){
|
95
|
+
working_dir "/tmp"
|
96
|
+
env "HOST" => hostname
|
97
|
+
}
|
98
|
+
E
|
99
|
+
Eye::Dsl.parse_apps(conf).should == {"bla" => {:name => "bla", :working_dir=>"/tmp", :environment=>{"HOST"=>"supa_server"}}}
|
100
|
+
end
|
101
|
+
|
102
|
+
end
|
103
|
+
|
104
|
+
end
|
data/spec/example/em.rb
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
require 'bundler/setup'
|
2
|
+
require 'eventmachine'
|
3
|
+
|
4
|
+
def answer(data)
|
5
|
+
case data
|
6
|
+
when 'ping' then "pong\n"
|
7
|
+
when 'bad' then "what\n"
|
8
|
+
when 'timeout' then sleep 5; "ok\n"
|
9
|
+
when 'exception' then raise 'haha'
|
10
|
+
when 'quit' then EM.stop
|
11
|
+
when 'big' then 'a' * 10_000_000
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
class Echo < EM::Connection
|
16
|
+
def post_init
|
17
|
+
puts "-- someone connected to the echo server!"
|
18
|
+
end
|
19
|
+
|
20
|
+
def receive_data data
|
21
|
+
puts "receive #{data.inspect}"
|
22
|
+
send_data(answer(data))
|
23
|
+
end
|
24
|
+
|
25
|
+
def unbind
|
26
|
+
puts "-- someone disconnected from the echo server!"
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
class EchoObj < EM::Connection
|
31
|
+
include EM::P::ObjectProtocol
|
32
|
+
|
33
|
+
def post_init
|
34
|
+
puts "-- someone connected to the echo server!"
|
35
|
+
end
|
36
|
+
|
37
|
+
def receive_object obj # {:command => 'ping'}
|
38
|
+
puts "receive #{obj.inspect}"
|
39
|
+
send_object(answer(obj[:command]).chop)
|
40
|
+
end
|
41
|
+
|
42
|
+
def unbind
|
43
|
+
puts "-- someone disconnected from the echo server!"
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
trap "TERM" do
|
48
|
+
EM.stop
|
49
|
+
`rm /tmp/em_test_sock_spec` rescue nil
|
50
|
+
end
|
51
|
+
|
52
|
+
EM.run do
|
53
|
+
EM.start_server '127.0.0.1', 33231, Echo
|
54
|
+
EM.start_server '127.0.0.1', 33232, EchoObj
|
55
|
+
EM.start_server "/tmp/em_test_sock_spec", nil, Echo
|
56
|
+
puts 'started'
|
57
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'bundler/setup'
|
2
|
+
require 'forking'
|
3
|
+
|
4
|
+
root = File.expand_path(File.dirname(__FILE__))
|
5
|
+
|
6
|
+
f = Forking.new(:name => 'forking', :working_dir => root,
|
7
|
+
:log_file => "#{root}/forking.log",
|
8
|
+
:pid_file => "#{root}/forking.pid", :sync_log => true)
|
9
|
+
|
10
|
+
3.times do |i|
|
11
|
+
f.spawn(:log_file => "#{root}/child#{i}.log", :sync_log => true) do
|
12
|
+
$0 = "forking child"
|
13
|
+
loop do
|
14
|
+
p "#{Time.now} - #{Time.now.to_f} - #{i} - tick"
|
15
|
+
sleep 0.1
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
f.run!
|
@@ -0,0 +1,154 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'optparse'
|
3
|
+
|
4
|
+
# This hash will hold all of the options
|
5
|
+
# parsed from the command-line by
|
6
|
+
# OptionParser.
|
7
|
+
options = {}
|
8
|
+
|
9
|
+
optparse = OptionParser.new do|opts|
|
10
|
+
# This displays the help screen, all programs are
|
11
|
+
# assumed to have this option.
|
12
|
+
opts.on( '-h', '--help', 'Display this screen' ) do
|
13
|
+
puts opts
|
14
|
+
exit
|
15
|
+
end
|
16
|
+
|
17
|
+
opts.on( '-p', '--pid FILE', 'pid_file' ) do |a|
|
18
|
+
options[:pid_file] = a
|
19
|
+
end
|
20
|
+
|
21
|
+
opts.on( '-l', '--log FILE', 'log_file' ) do |a|
|
22
|
+
options[:log_file] = a
|
23
|
+
end
|
24
|
+
|
25
|
+
opts.on( '-L', '--lock FILE', 'lock_file' ) do |a|
|
26
|
+
options[:lock_file] = a
|
27
|
+
end
|
28
|
+
|
29
|
+
opts.on( '-d', '--daemonize', 'Daemonize' ) do
|
30
|
+
options[:daemonize] = true
|
31
|
+
end
|
32
|
+
|
33
|
+
opts.on( '-s', '--daemonize_delay DELAY', 'Daemonized time' ) do |d|
|
34
|
+
options[:daemonize_delay] = d
|
35
|
+
end
|
36
|
+
|
37
|
+
opts.on( '-r', '--raise', 'Raised execution' ) do
|
38
|
+
options[:raise] = true
|
39
|
+
end
|
40
|
+
|
41
|
+
opts.on( '-w', '--watch_file FILE', 'Exit on touched file' ) do |w|
|
42
|
+
options[:watch_file] = w
|
43
|
+
end
|
44
|
+
|
45
|
+
opts.on( '-W', '--watch_file_delay DELAY', 'Exit on touched file, after delay' ) do |w|
|
46
|
+
options[:watch_file_delay] = w
|
47
|
+
end
|
48
|
+
|
49
|
+
opts.on( '-T', '--no_terminate', 'catch terminate signal and not die' ) do
|
50
|
+
options[:no_terminate] = true
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
54
|
+
|
55
|
+
optparse.parse!
|
56
|
+
|
57
|
+
module Sample
|
58
|
+
def puts(mes = "")
|
59
|
+
tm = Time.now
|
60
|
+
STDOUT.puts "#{tm.to_s} (#{tm.to_f}) - #{mes}"
|
61
|
+
STDOUT.flush
|
62
|
+
end
|
63
|
+
|
64
|
+
def daemonize(pid_file, log_file, daemonize_delay = 0)
|
65
|
+
puts "daemonize start #{pid_file}, #{log_file}, #{daemonize_delay}"
|
66
|
+
|
67
|
+
if daemonize_delay && daemonize_delay.to_f > 0
|
68
|
+
puts "daemonize delay start #{daemonize_delay}"
|
69
|
+
sleep daemonize_delay.to_f
|
70
|
+
puts "daemonize delay end"
|
71
|
+
end
|
72
|
+
|
73
|
+
daemon
|
74
|
+
STDOUT.reopen(log_file, "a")
|
75
|
+
STDERR.reopen(log_file, "a")
|
76
|
+
File.open(pid_file, 'w'){|f| f.write $$.to_s}
|
77
|
+
|
78
|
+
puts "daemonized"
|
79
|
+
end
|
80
|
+
|
81
|
+
def daemon
|
82
|
+
exit if fork # Parent exits, child continues.
|
83
|
+
Process.setsid # Become session leader.
|
84
|
+
exit if fork # Zap session leader. See [1].
|
85
|
+
|
86
|
+
STDIN.reopen "/dev/null" # Free file descriptors and
|
87
|
+
STDOUT.reopen "/dev/null", "a" # point them somewhere sensible.
|
88
|
+
STDERR.reopen '/dev/null', 'a'
|
89
|
+
return 0
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
extend Sample
|
94
|
+
|
95
|
+
if options[:daemonize]
|
96
|
+
daemonize(options[:pid_file], options[:log_file], options[:daemonize_delay])
|
97
|
+
end
|
98
|
+
|
99
|
+
puts "Started #{ARGV.inspect}, #{options.inspect}, #{ENV["ENV1"]}"
|
100
|
+
|
101
|
+
if options[:lock_file]
|
102
|
+
if File.exists?(options[:lock_file])
|
103
|
+
puts "Lock file exists, exiting"
|
104
|
+
exit 1
|
105
|
+
else
|
106
|
+
File.open(options[:lock_file], 'w'){|f| f.write $$ }
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
if options[:raise]
|
111
|
+
puts "Raised"
|
112
|
+
File.unlink(options[:lock_file]) if options[:lock_file]
|
113
|
+
exit 1
|
114
|
+
end
|
115
|
+
|
116
|
+
trap("USR1") do
|
117
|
+
puts "USR1 signal!"
|
118
|
+
end
|
119
|
+
|
120
|
+
trap("USR2") do
|
121
|
+
puts "USR2 start memory leak"
|
122
|
+
$ar = []
|
123
|
+
300_000.times{|i| $ar << "memory leak #{i}" * 10}
|
124
|
+
end
|
125
|
+
|
126
|
+
if options[:no_terminate]
|
127
|
+
trap("TERM") do
|
128
|
+
puts "TERM signal! and we not die O_o"
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
loop do
|
133
|
+
sleep 0.1
|
134
|
+
puts "tick"
|
135
|
+
|
136
|
+
if options[:watch_file]
|
137
|
+
if File.exists?(options[:watch_file])
|
138
|
+
puts "watch file finded"
|
139
|
+
File.unlink(options[:watch_file])
|
140
|
+
|
141
|
+
if options[:watch_file_delay]
|
142
|
+
puts "watch_file delay start"
|
143
|
+
sleep options[:watch_file_delay].to_f
|
144
|
+
puts "watch_file delay end"
|
145
|
+
end
|
146
|
+
|
147
|
+
break
|
148
|
+
end
|
149
|
+
end
|
150
|
+
end
|
151
|
+
|
152
|
+
puts "exit"
|
153
|
+
File.unlink(options[:lock_file]) if options[:lock_file]
|
154
|
+
exit 0
|
@@ -0,0 +1 @@
|
|
1
|
+
Eye.config{ http enable: true }
|
@@ -0,0 +1 @@
|
|
1
|
+
Eye.config{ http enable: false }
|
@@ -0,0 +1,20 @@
|
|
1
|
+
Eye.application("bla") do
|
2
|
+
environment "RAILS_ENV" => "production"
|
3
|
+
keep_alive false
|
4
|
+
stdall "12.log"
|
5
|
+
|
6
|
+
group("ha") do
|
7
|
+
5.times{|i|
|
8
|
+
process("ha_#{i}") do
|
9
|
+
environment "HA" => "1"
|
10
|
+
pid_file "/tmp/#{i}"
|
11
|
+
stdout "11.log"
|
12
|
+
end
|
13
|
+
}
|
14
|
+
end
|
15
|
+
|
16
|
+
process("1") do
|
17
|
+
pid_file "1"
|
18
|
+
stdall "1"
|
19
|
+
end
|
20
|
+
end
|