bluepill 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/bluepill/controller.rb +12 -12
- data/lib/bluepill/process.rb +8 -3
- data/lib/bluepill/system.rb +3 -1
- data/lib/bluepill/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6007963ed9836bc609625037bd170bed8057cf37
|
4
|
+
data.tar.gz: 0dbdd5043c20fad925290da16d63ef423b18ba83
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3a19e7ac04e1373bf37f2fbbeeef3bf827260326aa73573028d735da2acf03517469c6f5442a55826198dbd7b6dffec73b35aafa80e89f53ad1a5708db2d95ad
|
7
|
+
data.tar.gz: bb395f534f3f5ed497ed76318fcd72c898ff4bf9ff508ea1e657cb5f94e0891e8fea81436241285d299f54e42bcc2cdb036d48a50fd6e198502d9a308c8ef9e6
|
data/lib/bluepill/controller.rb
CHANGED
@@ -23,17 +23,6 @@ module Bluepill
|
|
23
23
|
case command.to_sym
|
24
24
|
when :status
|
25
25
|
puts send_to_daemon(application, :status, *args)
|
26
|
-
when *Application::PROCESS_COMMANDS
|
27
|
-
# these need to be sent to the daemon and the results printed out
|
28
|
-
affected = send_to_daemon(application, command, *args)
|
29
|
-
if affected.empty?
|
30
|
-
puts 'No processes effected'
|
31
|
-
else
|
32
|
-
puts "Sent #{command} to:"
|
33
|
-
affected.each do |process|
|
34
|
-
puts " #{process}"
|
35
|
-
end
|
36
|
-
end
|
37
26
|
when :quit
|
38
27
|
pid = pid_for(application)
|
39
28
|
if System.pid_alive?(pid)
|
@@ -52,6 +41,17 @@ module Bluepill
|
|
52
41
|
tail = "tail -n 100 -f #{log_file_location} | grep -E '#{grep_pattern}'"
|
53
42
|
puts "Tailing log for #{requested_pattern}..."
|
54
43
|
Kernel.exec(tail)
|
44
|
+
when *Application::PROCESS_COMMANDS
|
45
|
+
# these need to be sent to the daemon and the results printed out
|
46
|
+
affected = send_to_daemon(application, command, *args)
|
47
|
+
if affected.empty?
|
48
|
+
puts 'No processes effected'
|
49
|
+
else
|
50
|
+
puts "Sent #{command} to:"
|
51
|
+
affected.each do |process|
|
52
|
+
puts " #{process}"
|
53
|
+
end
|
54
|
+
end
|
55
55
|
else
|
56
56
|
$stderr.puts(format('Unknown command `%s` (or application `%s` has not been loaded yet)', command, command))
|
57
57
|
exit(1)
|
@@ -86,7 +86,7 @@ module Bluepill
|
|
86
86
|
def cleanup_bluepill_directory
|
87
87
|
running_applications.each do |app|
|
88
88
|
pid = pid_for(app)
|
89
|
-
next if pid
|
89
|
+
next if pid && System.pid_alive?(pid)
|
90
90
|
pid_file = File.join(pids_dir, "#{app}.pid")
|
91
91
|
sock_file = File.join(sockets_dir, "#{app}.sock")
|
92
92
|
System.delete_if_exists(pid_file)
|
data/lib/bluepill/process.rb
CHANGED
@@ -331,7 +331,7 @@ module Bluepill
|
|
331
331
|
logger.warning result.inspect
|
332
332
|
end
|
333
333
|
end
|
334
|
-
|
334
|
+
cleanup_process
|
335
335
|
elsif stop_signals
|
336
336
|
# issue stop signals with configurable delay between each
|
337
337
|
logger.warning "Sending stop signals to #{actual_pid}"
|
@@ -355,13 +355,13 @@ module Bluepill
|
|
355
355
|
logger.info "Sending signal #{signal} to #{process.actual_pid}"
|
356
356
|
process.signal_process(signal)
|
357
357
|
end
|
358
|
+
cleanup_process
|
358
359
|
end
|
359
360
|
else
|
360
361
|
logger.warning "Executing default stop command. Sending TERM signal to #{actual_pid}"
|
361
362
|
signal_process('TERM')
|
363
|
+
cleanup_process
|
362
364
|
end
|
363
|
-
ProcessJournal.kill_all_from_journal(name) # finish cleanup
|
364
|
-
unlink_pid # TODO: we only write the pid file if we daemonize, should we only unlink it if we daemonize?
|
365
365
|
|
366
366
|
skip_ticks_for(stop_grace_time)
|
367
367
|
end
|
@@ -389,6 +389,11 @@ module Bluepill
|
|
389
389
|
end
|
390
390
|
end
|
391
391
|
|
392
|
+
def cleanup_process
|
393
|
+
ProcessJournal.kill_all_from_journal(name) # finish cleanup
|
394
|
+
unlink_pid # TODO: we only write the pid file if we daemonize, should we only unlink it if we daemonize?
|
395
|
+
end
|
396
|
+
|
392
397
|
def clean_threads
|
393
398
|
@threads.each(&:kill)
|
394
399
|
@threads.clear
|
data/lib/bluepill/system.rb
CHANGED
@@ -26,6 +26,8 @@ module Bluepill
|
|
26
26
|
true
|
27
27
|
rescue Errno::ESRCH
|
28
28
|
false
|
29
|
+
rescue
|
30
|
+
false # other falsy (no pid)
|
29
31
|
end
|
30
32
|
|
31
33
|
def cpu_usage(pid, include_children)
|
@@ -197,7 +199,7 @@ module Bluepill
|
|
197
199
|
result = {
|
198
200
|
stdout: cmd_out_read.read,
|
199
201
|
stderr: cmd_err_read.read,
|
200
|
-
exit_code:
|
202
|
+
exit_code: $?.exitstatus,
|
201
203
|
}
|
202
204
|
|
203
205
|
# We're done with these ends of the pipes as well
|
data/lib/bluepill/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bluepill
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Arya Asemanfar
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2016-06-19 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activesupport
|
@@ -145,7 +145,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
145
145
|
version: '0'
|
146
146
|
requirements: []
|
147
147
|
rubyforge_project:
|
148
|
-
rubygems_version: 2.
|
148
|
+
rubygems_version: 2.5.1
|
149
149
|
signing_key:
|
150
150
|
specification_version: 4
|
151
151
|
summary: A process monitor written in Ruby with stability and minimalism in mind.
|