procodile 1.0.15 → 1.0.16
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/procodile/cli.rb +25 -3
- data/lib/procodile/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: 1f9970119b9f9480ad0894234851c37b852fa29b
|
4
|
+
data.tar.gz: 22e30024ec12580a2469d89520c28a03465e4e49
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 70036e03d4e9940d8460540302b91ebd0d94d70dfac2a8d73bf4ad29a4753bc9a4ed2c5e3c35f69bc7bdb4e707c019c86138da406ada41774f66c189a98bd79e
|
7
|
+
data.tar.gz: b8740fbfa8d2ceff5b0f053abef7e8958f934f1d7aaf636aeb18e3195685f58246166c82afd7f87178f4c8f31b3c372df5650236972e448b860609cfc15184f3
|
data/lib/procodile/cli.rb
CHANGED
@@ -432,12 +432,10 @@ module Procodile
|
|
432
432
|
|
433
433
|
def supervisor_running?
|
434
434
|
if pid = current_pid
|
435
|
-
|
435
|
+
self.class.pid_active?(pid)
|
436
436
|
else
|
437
437
|
false
|
438
438
|
end
|
439
|
-
rescue Errno::ESRCH
|
440
|
-
false
|
441
439
|
end
|
442
440
|
|
443
441
|
def current_pid
|
@@ -449,6 +447,12 @@ module Procodile
|
|
449
447
|
end
|
450
448
|
end
|
451
449
|
|
450
|
+
def self.pid_active?(pid)
|
451
|
+
::Process.getpgid(pid) ? true : false
|
452
|
+
rescue Errno::ESRCH
|
453
|
+
false
|
454
|
+
end
|
455
|
+
|
452
456
|
def process_names_from_cli_option
|
453
457
|
if @options[:processes]
|
454
458
|
processes = @options[:processes].split(',')
|
@@ -475,6 +479,8 @@ module Procodile
|
|
475
479
|
run_options[:force_single_log] = options[:foreground]
|
476
480
|
run_options[:port_allocations] = options[:port_allocations]
|
477
481
|
|
482
|
+
tidy_pids(config)
|
483
|
+
|
478
484
|
if options[:clean]
|
479
485
|
FileUtils.rm_rf(Dir[File.join(config.pid_root, '*')])
|
480
486
|
puts "Emptied PID directory"
|
@@ -503,5 +509,21 @@ module Procodile
|
|
503
509
|
end
|
504
510
|
end
|
505
511
|
|
512
|
+
def self.tidy_pids(config)
|
513
|
+
FileUtils.rm_f(config.supervisor_pid_path)
|
514
|
+
FileUtils.rm_f(config.sock_path)
|
515
|
+
pid_files = Dir[File.join(config.pid_root, '*.pid')]
|
516
|
+
pid_files.each do |pid_path|
|
517
|
+
file_name = pid_path.split('/').last
|
518
|
+
pid = File.read(pid_path).to_i
|
519
|
+
if self.pid_active?(pid)
|
520
|
+
puts "Could not remove #{file_name} because process (#{pid}) was active"
|
521
|
+
else
|
522
|
+
FileUtils.rm_f(pid_path)
|
523
|
+
puts "Removed #{file_name} because process was not active"
|
524
|
+
end
|
525
|
+
end
|
526
|
+
end
|
527
|
+
|
506
528
|
end
|
507
529
|
end
|
data/lib/procodile/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: procodile
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.16
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Cooke
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-05-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -70,7 +70,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
70
70
|
version: '0'
|
71
71
|
requirements: []
|
72
72
|
rubyforge_project:
|
73
|
-
rubygems_version: 2.5.
|
73
|
+
rubygems_version: 2.5.1
|
74
74
|
signing_key:
|
75
75
|
specification_version: 4
|
76
76
|
summary: This gem will help you run Ruby processes from a Procfile on Linux servers
|