cap_unicorn 0.0.6 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/cap_unicorn/recipes.rb +26 -1
- metadata +4 -4
data/lib/cap_unicorn/recipes.rb
CHANGED
@@ -5,7 +5,15 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
5
5
|
end
|
6
6
|
|
7
7
|
def self.master_pid
|
8
|
-
pid = capture "pid=$(ps aux | grep #{command_name} | grep master | grep -v grep | grep #{current_path}); echo $pid"
|
8
|
+
pid = capture "pid=$(ps aux | grep #{command_name} | grep master | grep -v '(old)' | grep -v grep | grep #{current_path}); echo $pid"
|
9
|
+
|
10
|
+
unless pid.empty?
|
11
|
+
pid.split(" ")[1]
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.old_master_pid
|
16
|
+
pid = capture "pid=$(ps aux | grep #{command_name} | grep master | grep '(old)' | grep -v grep | grep #{current_path}); echo $pid"
|
9
17
|
|
10
18
|
unless pid.empty?
|
11
19
|
pid.split(" ")[1]
|
@@ -21,6 +29,23 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
21
29
|
task :restart do
|
22
30
|
if pid = master_pid
|
23
31
|
run "kill -s USR2 #{pid}"
|
32
|
+
|
33
|
+
loop do
|
34
|
+
puts "Searching for newly spawned master process..."
|
35
|
+
|
36
|
+
if pid = master_pid
|
37
|
+
puts "Found new master process..."
|
38
|
+
|
39
|
+
if old_pid = old_master_pid
|
40
|
+
run "kill -s WINCH #{old_pid}"
|
41
|
+
run "kill -s QUIT #{old_pid}"
|
42
|
+
end
|
43
|
+
|
44
|
+
break
|
45
|
+
end
|
46
|
+
|
47
|
+
sleep 1
|
48
|
+
end
|
24
49
|
end
|
25
50
|
end
|
26
51
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cap_unicorn
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 17
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 7
|
10
|
+
version: 0.0.7
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Scott Taylor
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-
|
18
|
+
date: 2010-12-05 00:00:00 -05:00
|
19
19
|
default_executable:
|
20
20
|
dependencies: []
|
21
21
|
|