runit-man 1.7.4 → 1.8.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -32,6 +32,19 @@ runit:
32
32
  restart: Restart
33
33
  switch_down: Deactivate
34
34
  switch_up: Activate
35
+ signals:
36
+ t: TERM
37
+ k: KILL
38
+ i: INT
39
+ 1: USR1
40
+ 2: USR2
41
+ a: ALARM
42
+ q: QUIT
43
+ x: EXIT
44
+ p: PAUSE
45
+ c: CONT
46
+ h: HUP
47
+ o: ONCE
35
48
  log:
36
49
  title: "Tail %3 lines of service %1 log - %2"
37
50
  header: "Tail %3 lines of service <strong>%1</strong> log: %2 (<code>%4</code>)"
@@ -34,6 +34,19 @@ runit:
34
34
  restart: Перезапустить
35
35
  switch_down: Выключить
36
36
  switch_up: Включить
37
+ signals:
38
+ t: TERM
39
+ k: KILL
40
+ i: INT
41
+ 1: USR1
42
+ 2: USR2
43
+ a: ALARM
44
+ q: QUIT
45
+ x: EXIT
46
+ p: PAUSE
47
+ c: CONT
48
+ h: HUP
49
+ o: ONCE
37
50
  log:
38
51
  title: "Последние %3 строк лога сервиса %1 - %2"
39
52
  header: "Последние %3 строк лога сервиса <strong>%1</strong>: %2 (<code>%4</code>)"
@@ -1,76 +1,84 @@
1
- require 'socket'
2
- require 'runit-man/service_info'
3
- require 'runit-man/partials'
4
- require 'sinatra/content_for'
5
-
6
- module Helpers
7
- include Rack::Utils
8
- include Sinatra::Partials
9
- include Sinatra::ContentFor
10
- alias_method :h, :escape_html
11
-
12
- attr_accessor :even_or_odd_state
13
-
14
- def host_name
15
- unless @host_name
16
- begin
17
- @host_name = Socket.gethostbyname(Socket.gethostname).first
18
- rescue
19
- @host_name = Socket.gethostname
20
- end
21
- end
22
- @host_name
23
- end
24
-
25
- def service_infos
26
- ServiceInfo.all
27
- end
28
-
29
- def files_to_view
30
- RunitMan.files_to_view.map do |f|
31
- File.symlink?(f) ? File.expand_path(File.readlink(f), File.dirname(f)) : f
32
- end.select do |f|
33
- File.readable?(f)
34
- end.uniq.sort
35
- end
36
-
37
- def all_files_to_view
38
- (files_to_view + service_infos.map do |service|
39
- service.files_to_view
40
- end.flatten).uniq.sort
41
- end
42
-
43
- def service_action(name, action, label)
44
- partial :service_action, :locals => {
45
- :name => name,
46
- :action => action,
47
- :label => label
48
- }
49
- end
50
-
51
- def log_link(name, options = {})
52
- count = (options[:count] || 100).to_i
53
- title = options[:title].to_s || count
54
- blank = options[:blank] || false
55
- hint = options[:hint].to_s || ''
56
- raw = options[:raw] || false
57
- hint = " title=\"#{h(hint)}\"" unless hint.empty?
58
- blank = blank ? ' target="_blank"' : ''
59
- "<a#{hint}#{blank} href=\"/#{h(name)}/log#{ (count != 100) ? "/#{count}" : '' }#{ raw ? '.txt' : '' }#footer\">#{h(title)}</a>"
60
- end
61
-
62
- def even_or_odd
63
- self.even_or_odd_state = !even_or_odd_state
64
- even_or_odd_state
65
- end
66
-
67
- def stat_subst(s)
68
- s.split(/\s/).map do |s|
69
- if s =~ /(\w+)/ && t.runit.services.table.subst[$1].translated?
70
- s.sub(/\w+/, t.runit.services.table.subst[$1].to_s)
71
- else
72
- s
73
- end
74
- end.join(' ')
75
- end
76
- end
1
+ require 'socket'
2
+ require 'runit-man/service_info'
3
+ require 'runit-man/partials'
4
+ require 'sinatra/content_for'
5
+
6
+ module Helpers
7
+ include Rack::Utils
8
+ include Sinatra::Partials
9
+ include Sinatra::ContentFor
10
+ alias_method :h, :escape_html
11
+
12
+ attr_accessor :even_or_odd_state
13
+
14
+ def host_name
15
+ unless @host_name
16
+ begin
17
+ @host_name = Socket.gethostbyname(Socket.gethostname).first
18
+ rescue
19
+ @host_name = Socket.gethostname
20
+ end
21
+ end
22
+ @host_name
23
+ end
24
+
25
+ def service_infos
26
+ ServiceInfo.all
27
+ end
28
+
29
+ def files_to_view
30
+ RunitMan.files_to_view.map do |f|
31
+ File.symlink?(f) ? File.expand_path(File.readlink(f), File.dirname(f)) : f
32
+ end.select do |f|
33
+ File.readable?(f)
34
+ end.uniq.sort
35
+ end
36
+
37
+ def all_files_to_view
38
+ (files_to_view + service_infos.map do |service|
39
+ service.files_to_view
40
+ end.flatten).uniq.sort
41
+ end
42
+
43
+ def service_action(name, action, label)
44
+ partial :service_action, :locals => {
45
+ :name => name,
46
+ :action => action,
47
+ :label => label
48
+ }
49
+ end
50
+
51
+ def service_signal(name, signal, label)
52
+ partial :service_signal, :locals => {
53
+ :name => name,
54
+ :signal => signal,
55
+ :label => label
56
+ }
57
+ end
58
+
59
+ def log_link(name, options = {})
60
+ count = (options[:count] || 100).to_i
61
+ title = options[:title].to_s || count
62
+ blank = options[:blank] || false
63
+ hint = options[:hint].to_s || ''
64
+ raw = options[:raw] || false
65
+ hint = " title=\"#{h(hint)}\"" unless hint.empty?
66
+ blank = blank ? ' target="_blank"' : ''
67
+ "<a#{hint}#{blank} href=\"/#{h(name)}/log#{ (count != 100) ? "/#{count}" : '' }#{ raw ? '.txt' : '' }#footer\">#{h(title)}</a>"
68
+ end
69
+
70
+ def even_or_odd
71
+ self.even_or_odd_state = !even_or_odd_state
72
+ even_or_odd_state
73
+ end
74
+
75
+ def stat_subst(s)
76
+ s.split(/\s/).map do |s|
77
+ if s =~ /(\w+)/ && t.runit.services.table.subst[$1].translated?
78
+ s.sub(/\w+/, t.runit.services.table.subst[$1].to_s)
79
+ else
80
+ s
81
+ end
82
+ end.join(' ')
83
+ end
84
+ end
@@ -1,222 +1,233 @@
1
- require 'runit-man/log_location_cache'
2
- require 'runit-man/service_status'
3
-
4
- class ServiceInfo
5
- attr_reader :name
6
-
7
- def initialize(a_name)
8
- @name = a_name
9
- @files = {}
10
-
11
- @status = ServiceStatus.new(data_from_file(File.join(supervise_folder, 'status')))
12
- @log_status = ServiceStatus.new(data_from_file(File.join(log_supervise_folder, 'status')))
13
- end
14
-
15
- def to_json(*a)
16
- data = {}
17
- [
18
- :name, :stat, :active?, :logged?, :switchable?,
19
- :log_file_location, :log_pid
20
- ].each do |sym|
21
- data[sym] = send(sym)
22
- end
23
-
24
- [
25
- :run?, :pid, :finish?, :down?,
26
- :want_up?, :want_down?, :got_term?,
27
- :started_at, :uptime
28
- ].each do |sym|
29
- data[sym] = @status.send(sym)
30
- end
31
- data.to_json(*a)
32
- end
33
-
34
- def logged?
35
- File.directory?(log_supervise_folder)
36
- end
37
-
38
- def stat
39
- r = data_from_file(File.join(supervise_folder, 'stat'))
40
- r ? r : 'inactive'
41
- end
42
-
43
- def active?
44
- File.directory?(active_service_folder) || File.symlink?(active_service_folder)
45
- end
46
-
47
- def switchable?
48
- File.symlink?(active_service_folder) || File.directory?(inactive_service_folder)
49
- end
50
-
51
- def down?
52
- @status.down?
53
- end
54
-
55
- def run?
56
- @status.run?
57
- end
58
-
59
- def up!
60
- send_signal :u
61
- end
62
-
63
- def down!
64
- send_signal :d
65
- end
66
-
67
- def switch_down!
68
- down!
69
- File.unlink(active_service_folder)
70
- end
71
-
72
- def switch_up!
73
- File.symlink(inactive_service_folder, active_service_folder)
74
- end
75
-
76
- def restart!
77
- down!
78
- up!
79
- end
80
-
81
- def pid
82
- @status.pid
83
- end
84
-
85
- def uptime
86
- @status.uptime
87
- end
88
-
89
- def log_pid
90
- @log_status.pid
91
- end
92
-
93
- def log_file_location
94
- rel_path = self.class.log_location_cache[log_pid]
95
- return nil if rel_path.nil?
96
- File.expand_path(rel_path, log_run_folder)
97
- end
98
-
99
- def send_signal(signal)
100
- return unless supervise?
101
- File.open(File.join(supervise_folder, 'control'), 'w') do |f|
102
- f.print signal.to_s
103
- end
104
- end
105
-
106
- def files_to_view
107
- return [] unless File.directory?(files_to_view_folder)
108
- Dir.entries(files_to_view_folder).select do |name|
109
- File.symlink?(File.join(files_to_view_folder, name))
110
- end.map do |name|
111
- File.expand_path(
112
- File.readlink(File.join(files_to_view_folder, name)),
113
- files_to_view_folder
114
- )
115
- end.select do |file_path|
116
- File.file?(file_path)
117
- end
118
- end
119
-
120
- def urls_to_view
121
- return [] unless File.directory?(urls_to_view_folder)
122
- Dir.entries(urls_to_view_folder).select do |name|
123
- name =~ /\.url$/ && File.file?(File.join(urls_to_view_folder, name))
124
- end.map do |name|
125
- data_from_file(File.join(urls_to_view_folder, name))
126
- end.select do |url|
127
- !url.nil?
128
- end
129
- end
130
-
131
- private
132
- def inactive_service_folder
133
- File.join(RunitMan.all_services_directory, name)
134
- end
135
-
136
- def active_service_folder
137
- File.join(RunitMan.active_services_directory, name)
138
- end
139
-
140
- def files_to_view_folder
141
- File.join(active_service_folder, 'runit-man', 'files-to-view')
142
- end
143
-
144
- def urls_to_view_folder
145
- File.join(active_service_folder, 'runit-man', 'urls-to-view')
146
- end
147
-
148
- def supervise_folder
149
- File.join(active_service_folder, 'supervise')
150
- end
151
-
152
- def log_run_folder
153
- File.join(active_service_folder, 'log')
154
- end
155
-
156
- def log_supervise_folder
157
- File.join(log_run_folder, 'supervise')
158
- end
159
-
160
- def supervise?
161
- File.directory?(supervise_folder)
162
- end
163
-
164
- def data_from_file(file_name)
165
- return @files[file_name] if @files.include?(file_name)
166
- @files[file_name] = self.class.real_data_from_file(file_name)
167
- end
168
-
169
- class << self
170
- def all
171
- all_service_names.sort.map do |name|
172
- ServiceInfo.new(name)
173
- end
174
- end
175
-
176
- def [](name)
177
- all_service_names.include?(name) ? ServiceInfo.new(name) : nil
178
- end
179
-
180
- def log_location_cache
181
- unless @log_location_cache
182
- @log_location_cache = LogLocationCache.new
183
- end
184
- @log_location_cache
185
- end
186
-
187
- def real_data_from_file(file_name)
188
- return nil unless File.readable?(file_name)
189
- data = IO.read(file_name)
190
- data.chomp! unless data.nil?
191
- data.empty? ? nil : data
192
- end
193
-
194
- private
195
- def itself_or_parent?(name)
196
- name == '.' || name == '..'
197
- end
198
-
199
- def active_service_names
200
- return [] unless File.directory?(RunitMan.active_services_directory)
201
- Dir.entries(RunitMan.active_services_directory).reject do |name|
202
- full_name = File.join(RunitMan.active_services_directory, name)
203
- itself_or_parent?(name) || (!File.symlink?(full_name) && !File.directory?(full_name))
204
- end
205
- end
206
-
207
- def inactive_service_names
208
- return [] unless File.directory?(RunitMan.all_services_directory)
209
- actives = active_service_names
210
- Dir.entries(RunitMan.all_services_directory).reject do |name|
211
- full_name = File.join(RunitMan.all_services_directory, name)
212
- itself_or_parent?(name) || !File.directory?(full_name) || actives.include?(name)
213
- end
214
- end
215
-
216
- def all_service_names
217
- (active_service_names + inactive_service_names)
218
- end
219
-
220
- end
221
- end
222
-
1
+ require 'runit-man/log_location_cache'
2
+ require 'runit-man/service_status'
3
+
4
+ class ServiceInfo
5
+ attr_reader :name
6
+
7
+ def initialize(a_name)
8
+ @name = a_name
9
+ @files = {}
10
+
11
+ @status = ServiceStatus.new(data_from_file(File.join(supervise_folder, 'status')))
12
+ @log_status = ServiceStatus.new(data_from_file(File.join(log_supervise_folder, 'status')))
13
+ end
14
+
15
+ def to_json(*a)
16
+ data = {}
17
+ [
18
+ :name, :stat, :active?, :logged?, :switchable?,
19
+ :log_file_location, :log_pid
20
+ ].each do |sym|
21
+ data[sym] = send(sym)
22
+ end
23
+
24
+ [
25
+ :run?, :pid, :finish?, :down?,
26
+ :want_up?, :want_down?, :got_term?,
27
+ :started_at, :uptime
28
+ ].each do |sym|
29
+ data[sym] = @status.send(sym)
30
+ end
31
+ data.to_json(*a)
32
+ end
33
+
34
+ def logged?
35
+ File.directory?(log_supervise_folder)
36
+ end
37
+
38
+ def stat
39
+ r = data_from_file(File.join(supervise_folder, 'stat'))
40
+ r ? r : 'inactive'
41
+ end
42
+
43
+ def active?
44
+ File.directory?(active_service_folder) || File.symlink?(active_service_folder)
45
+ end
46
+
47
+ def switchable?
48
+ File.symlink?(active_service_folder) || File.directory?(inactive_service_folder)
49
+ end
50
+
51
+ def down?
52
+ @status.down?
53
+ end
54
+
55
+ def run?
56
+ @status.run?
57
+ end
58
+
59
+ def up!
60
+ send_signal :u
61
+ end
62
+
63
+ def down!
64
+ send_signal :d
65
+ end
66
+
67
+ def switch_down!
68
+ down!
69
+ File.unlink(active_service_folder)
70
+ end
71
+
72
+ def switch_up!
73
+ File.symlink(inactive_service_folder, active_service_folder)
74
+ end
75
+
76
+ def restart!
77
+ down!
78
+ up!
79
+ end
80
+
81
+ def pid
82
+ @status.pid
83
+ end
84
+
85
+ def uptime
86
+ @status.uptime
87
+ end
88
+
89
+ def log_pid
90
+ @log_status.pid
91
+ end
92
+
93
+ def log_file_location
94
+ rel_path = ServiceInfo.log_location_cache[log_pid]
95
+ return nil if rel_path.nil?
96
+ File.expand_path(rel_path, log_run_folder)
97
+ end
98
+
99
+ def send_signal(signal)
100
+ return unless supervise?
101
+ File.open(File.join(supervise_folder, 'control'), 'w') do |f|
102
+ f.print signal.to_s
103
+ end
104
+ end
105
+
106
+ def files_to_view
107
+ return [] unless File.directory?(files_to_view_folder)
108
+ Dir.entries(files_to_view_folder).select do |name|
109
+ File.symlink?(File.join(files_to_view_folder, name))
110
+ end.map do |name|
111
+ File.expand_path(
112
+ File.readlink(File.join(files_to_view_folder, name)),
113
+ files_to_view_folder
114
+ )
115
+ end.select do |file_path|
116
+ File.file?(file_path)
117
+ end
118
+ end
119
+
120
+ def urls_to_view
121
+ return [] unless File.directory?(urls_to_view_folder)
122
+ Dir.entries(urls_to_view_folder).select do |name|
123
+ name =~ /\.url$/ && File.file?(File.join(urls_to_view_folder, name))
124
+ end.map do |name|
125
+ data_from_file(File.join(urls_to_view_folder, name))
126
+ end.select do |url|
127
+ !url.nil?
128
+ end
129
+ end
130
+
131
+ def allowed_signals
132
+ return [] unless File.directory?(allowed_signals_folder)
133
+ Dir.entries(allowed_signals_folder).reject do |name|
134
+ ServiceInfo.itself_or_parent?(name)
135
+ end
136
+ end
137
+
138
+ private
139
+ def inactive_service_folder
140
+ File.join(RunitMan.all_services_directory, name)
141
+ end
142
+
143
+ def active_service_folder
144
+ File.join(RunitMan.active_services_directory, name)
145
+ end
146
+
147
+ def files_to_view_folder
148
+ File.join(active_service_folder, 'runit-man', 'files-to-view')
149
+ end
150
+
151
+ def urls_to_view_folder
152
+ File.join(active_service_folder, 'runit-man', 'urls-to-view')
153
+ end
154
+
155
+ def allowed_signals_folder
156
+ File.join(active_service_folder, 'runit-man', 'allowed-signals')
157
+ end
158
+
159
+ def supervise_folder
160
+ File.join(active_service_folder, 'supervise')
161
+ end
162
+
163
+ def log_run_folder
164
+ File.join(active_service_folder, 'log')
165
+ end
166
+
167
+ def log_supervise_folder
168
+ File.join(log_run_folder, 'supervise')
169
+ end
170
+
171
+ def supervise?
172
+ File.directory?(supervise_folder)
173
+ end
174
+
175
+ def data_from_file(file_name)
176
+ return @files[file_name] if @files.include?(file_name)
177
+ @files[file_name] = ServiceInfo.real_data_from_file(file_name)
178
+ end
179
+
180
+ class << self
181
+ def all
182
+ all_service_names.sort.map do |name|
183
+ ServiceInfo.new(name)
184
+ end
185
+ end
186
+
187
+ def [](name)
188
+ all_service_names.include?(name) ? ServiceInfo.new(name) : nil
189
+ end
190
+
191
+ def log_location_cache
192
+ unless @log_location_cache
193
+ @log_location_cache = LogLocationCache.new
194
+ end
195
+ @log_location_cache
196
+ end
197
+
198
+ def real_data_from_file(file_name)
199
+ return nil unless File.readable?(file_name)
200
+ data = IO.read(file_name)
201
+ data.chomp! unless data.nil?
202
+ data.empty? ? nil : data
203
+ end
204
+
205
+ def itself_or_parent?(name)
206
+ name == '.' || name == '..'
207
+ end
208
+
209
+ private
210
+ def active_service_names
211
+ return [] unless File.directory?(RunitMan.active_services_directory)
212
+ Dir.entries(RunitMan.active_services_directory).reject do |name|
213
+ full_name = File.join(RunitMan.active_services_directory, name)
214
+ itself_or_parent?(name) || (!File.symlink?(full_name) && !File.directory?(full_name))
215
+ end
216
+ end
217
+
218
+ def inactive_service_names
219
+ return [] unless File.directory?(RunitMan.all_services_directory)
220
+ actives = active_service_names
221
+ Dir.entries(RunitMan.all_services_directory).reject do |name|
222
+ full_name = File.join(RunitMan.all_services_directory, name)
223
+ itself_or_parent?(name) || !File.directory?(full_name) || actives.include?(name)
224
+ end
225
+ end
226
+
227
+ def all_service_names
228
+ (active_service_names + inactive_service_names)
229
+ end
230
+
231
+ end
232
+ end
233
+
@@ -1,22 +1,22 @@
1
- form.service-action
2
- {
3
- display: inline;
4
- }
5
- #container{margin:0 auto;border-top:0;width:900px;border-top:0;}
6
- .content{position:relative;padding: 16px 0;color:#c0baba;font-size:1.27em;line-height:1.7}
7
- .content:after{content:".";display:block;height:0;clear:both;visibility:hidden;}
8
- .content{display:inline-block;}
9
- /* \*/ * html .content{height:1%;}.content{display:block;}/* */
1
+ form.service-action, form.service-signal
2
+ {
3
+ display: inline;
4
+ }
5
+ #container{margin:0 auto;border-top:0;width:900px;border-top:0;}
6
+ .content{position:relative;padding: 16px 0;color:#c0baba;font-size:1.27em;line-height:1.7}
7
+ .content:after{content:".";display:block;height:0;clear:both;visibility:hidden;}
8
+ .content{display:inline-block;}
9
+ /* \*/ * html .content{height:1%;}.content{display:block;}/* */
10
+
11
+ #error { display: none; }
12
+ .error, .notice, .success {padding:.8em;margin-bottom:1em;border:2px solid #ddd;}
13
+ .error {background:#FBE3E4;color:#8a1f11;border-color:#FBC2C4;}
14
+ .notice {background:#FFF6BF;color:#514721;border-color:#FFD324;}
15
+ .success {background:#E6EFC2;color:#264409;border-color:#C6D880;}
16
+ .error a {color:#8a1f11;}
17
+ .notice a {color:#514721;}
18
+ .success a {color:#264409;}
10
19
 
11
- #error { display: none; }
12
- .error, .notice, .success {padding:.8em;margin-bottom:1em;border:2px solid #ddd;}
13
- .error {background:#FBE3E4;color:#8a1f11;border-color:#FBC2C4;}
14
- .notice {background:#FFF6BF;color:#514721;border-color:#FFD324;}
15
- .success {background:#E6EFC2;color:#264409;border-color:#C6D880;}
16
- .error a {color:#8a1f11;}
17
- .notice a {color:#514721;}
18
- .success a {color:#264409;}
19
-
20
- span.inactive {color:#gray;}
21
- span.down {color:#8a1f11;}
22
- span.run {color:#264409;}
20
+ span.inactive {color:#gray;}
21
+ span.down {color:#8a1f11;}
22
+ span.run {color:#264409;}
@@ -1,66 +1,66 @@
1
- (function($)
2
- {
3
- var REFRESH_SERVICES_TIMEOUT = 5000;
4
-
5
- $.ajaxSetup({
6
- error: function(e, req, options, error)
7
- {
8
- $('#url').text(settings.url);
9
- $('#error').show();
10
- }
11
- });
12
-
13
- var needRefreshServices;
14
- var refreshServices = function()
15
- {
16
- refreshServices.timer = null;
17
- $.ajax({
18
- url: '/services',
19
- cache: false,
20
- error: function()
21
- {
22
- $('#url').text('/services');
23
- $('#error').show();
24
- },
25
- success: function(html)
26
- {
27
- $('#error').hide();
28
- $('#services').html(html);
29
- },
30
- complete: function()
31
- {
32
- needRefreshServices(false);
33
- }
34
- });
35
- };
36
-
37
- needRefreshServices = function(now)
38
- {
39
- if (refreshServices.timer != null)
40
- {
41
- clearTimeout(refreshServices.timer);
42
- refreshServices.timer = null;
43
- }
44
- if (now)
45
- {
46
- refreshServices();
47
- }
48
- else
49
- {
50
- refreshServices.timer = setTimeout(refreshServices, REFRESH_SERVICES_TIMEOUT);
51
- }
52
- };
53
-
54
- $('#services').delegate('form.service-action', 'submit', function()
55
- {
56
- $.post($(this).attr('action'), function(data)
57
- {
58
- needRefreshServices(true);
59
- });
60
- return false;
61
- });
62
-
63
- $('#service-refresh-interval').text(REFRESH_SERVICES_TIMEOUT / 1000);
64
-
65
- needRefreshServices(true);
66
- })(jQuery);
1
+ (function($)
2
+ {
3
+ var REFRESH_SERVICES_TIMEOUT = 5000;
4
+
5
+ $.ajaxSetup({
6
+ error: function(e, req, options, error)
7
+ {
8
+ $('#url').text(settings.url);
9
+ $('#error').show();
10
+ }
11
+ });
12
+
13
+ var needRefreshServices;
14
+ var refreshServices = function()
15
+ {
16
+ refreshServices.timer = null;
17
+ $.ajax({
18
+ url: '/services',
19
+ cache: false,
20
+ error: function()
21
+ {
22
+ $('#url').text('/services');
23
+ $('#error').show();
24
+ },
25
+ success: function(html)
26
+ {
27
+ $('#error').hide();
28
+ $('#services').html(html);
29
+ },
30
+ complete: function()
31
+ {
32
+ needRefreshServices(false);
33
+ }
34
+ });
35
+ };
36
+
37
+ needRefreshServices = function(now)
38
+ {
39
+ if (refreshServices.timer != null)
40
+ {
41
+ clearTimeout(refreshServices.timer);
42
+ refreshServices.timer = null;
43
+ }
44
+ if (now)
45
+ {
46
+ refreshServices();
47
+ }
48
+ else
49
+ {
50
+ refreshServices.timer = setTimeout(refreshServices, REFRESH_SERVICES_TIMEOUT);
51
+ }
52
+ };
53
+
54
+ $('#services').delegate('form.service-action,form.service-signal', 'submit', function()
55
+ {
56
+ $.post($(this).attr('action'), function(data)
57
+ {
58
+ needRefreshServices(true);
59
+ });
60
+ return false;
61
+ });
62
+
63
+ $('#service-refresh-interval').text(REFRESH_SERVICES_TIMEOUT / 1000);
64
+
65
+ needRefreshServices(true);
66
+ })(jQuery);
@@ -11,6 +11,9 @@ need_second_row = !service_info.files_to_view.empty? || !service_info.urls_to_vi
11
11
  <% unless service_info.down? %>
12
12
  <%= service_action service_info.name, :restart, t.runit.services.table.actions.restart %>
13
13
  <%= service_action service_info.name, :down, t.runit.services.table.actions.stop %>
14
+ <% service_info.allowed_signals.each do |signal| %>
15
+ <%= service_signal service_info.name, signal, t.runit.services.table.signals[signal] %>
16
+ <% end %>
14
17
  <% else %>
15
18
  <%= service_action service_info.name, :up, t.runit.services.table.actions.start %>
16
19
  <% end %>
@@ -31,7 +34,7 @@ need_second_row = !service_info.files_to_view.empty? || !service_info.urls_to_vi
31
34
  <% end %>
32
35
  </td>
33
36
  </tr>
34
- <% if need_second_row %><tr><td colspan="4">
37
+ <% if need_second_row %><tr><td colspan="5">
35
38
  <% unless service_info.files_to_view.empty? %>
36
39
  <%= h(t.runit.services.table.values.files_to_view) %>:
37
40
  <% service_info.files_to_view.each do |f| %>
@@ -0,0 +1,3 @@
1
+ <form class="service-signal" action="<%= h(name) %>/signal/<%= h(signal) %>" method="POST">
2
+ <input type="submit" value="<%= h(label) %>" />
3
+ </form>
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 1
7
- - 7
8
- - 4
9
- version: 1.7.4
7
+ - 8
8
+ - 0
9
+ version: 1.8.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Akzhan Abdulin
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-05-24 00:00:00 +04:00
17
+ date: 2010-05-25 00:00:00 +04:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -150,6 +150,7 @@ files:
150
150
  - views/layout.erb
151
151
  - views/view_file.erb
152
152
  - views/index.erb
153
+ - views/_service_signal.erb
153
154
  - views/_services.erb
154
155
  - views/_service_action.erb
155
156
  - views/_service_info.erb