bluepill 0.0.18 → 0.0.19
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/VERSION +1 -1
- data/bin/bluepill +10 -4
- data/bluepill.gemspec +2 -2
- data/lib/bluepill/application.rb +9 -1
- data/lib/bluepill/controller.rb +1 -1
- data/lib/bluepill/system.rb +9 -0
- data/lib/example.rb +2 -3
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.19
|
data/bin/bluepill
CHANGED
@@ -5,7 +5,8 @@ require 'bluepill'
|
|
5
5
|
|
6
6
|
# defaults
|
7
7
|
options = {
|
8
|
-
:log_file => "/var/log/bluepill.log"
|
8
|
+
:log_file => "/var/log/bluepill.log",
|
9
|
+
:base_dir => "/var/bluepill"
|
9
10
|
}
|
10
11
|
|
11
12
|
OptionParser.new do |opts|
|
@@ -22,6 +23,11 @@ end.parse!
|
|
22
23
|
|
23
24
|
APPLICATION_COMMANDS = %w(status start stop restart unmonitor quit log)
|
24
25
|
|
26
|
+
unless File.writable?(options[:base_dir])
|
27
|
+
$stderr.puts "Error: You don't have permissions to #{options[:base_dir]}\nYou should run bluepill as root."
|
28
|
+
exit(3)
|
29
|
+
end
|
30
|
+
|
25
31
|
controller = Bluepill::Controller.new(options.slice(:base_dir))
|
26
32
|
|
27
33
|
if controller.running_applications.include?(ARGV.first)
|
@@ -36,10 +42,10 @@ elsif APPLICATION_COMMANDS.include?(ARGV.first)
|
|
36
42
|
$stderr.puts " #{index + 1}. #{app}"
|
37
43
|
end
|
38
44
|
$stderr.puts "Usage: bluepill [app] cmd [options]"
|
39
|
-
exit
|
45
|
+
exit(1)
|
40
46
|
else
|
41
|
-
$stderr.puts "There are no running bluepill daemons.\nTo start a bluepill daemon, use: bluepill load <config file>"
|
42
|
-
exit
|
47
|
+
$stderr.puts "Error: There are no running bluepill daemons.\nTo start a bluepill daemon, use: bluepill load <config file>"
|
48
|
+
exit(2)
|
43
49
|
end
|
44
50
|
end
|
45
51
|
|
data/bluepill.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{bluepill}
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.19"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Arya Asemanfar", "Gary Tsang", "Rohith Ravi"]
|
12
|
-
s.date = %q{2009-11-
|
12
|
+
s.date = %q{2009-11-12}
|
13
13
|
s.default_executable = %q{bluepill}
|
14
14
|
s.description = %q{Bluepill keeps your daemons up while taking up as little resources as possible. After all you probably want the resources of your server to be used by whatever daemons you are running rather than the thing that's supposed to make sure they are brought back up, should they die or misbehave.}
|
15
15
|
s.email = %q{entombedvirus@gmail.com}
|
data/lib/bluepill/application.rb
CHANGED
@@ -184,7 +184,15 @@ private
|
|
184
184
|
rescue Exception => e
|
185
185
|
exit unless e.is_a?(Errno::ESRCH)
|
186
186
|
else
|
187
|
-
|
187
|
+
5.times do |i|
|
188
|
+
sleep 0.5
|
189
|
+
break unless System.pid_alive?(previous_pid)
|
190
|
+
end
|
191
|
+
|
192
|
+
if System.pid_alive?(previous_pid)
|
193
|
+
$stderr.puts "Previous bluepilld[#{previous_pid}] didn't die"
|
194
|
+
exit(4)
|
195
|
+
end
|
188
196
|
end
|
189
197
|
end
|
190
198
|
|
data/lib/bluepill/controller.rb
CHANGED
@@ -6,7 +6,7 @@ module Bluepill
|
|
6
6
|
attr_accessor :applications
|
7
7
|
|
8
8
|
def initialize(options = {})
|
9
|
-
self.base_dir = options[:base_dir]
|
9
|
+
self.base_dir = options[:base_dir]
|
10
10
|
self.sockets_dir = File.join(base_dir, 'socks')
|
11
11
|
self.pids_dir = File.join(base_dir, 'pids')
|
12
12
|
self.applications = Hash.new
|
data/lib/bluepill/system.rb
CHANGED
data/lib/example.rb
CHANGED
@@ -48,7 +48,7 @@ Bluepill.application(:sample_app) do |app|
|
|
48
48
|
|
49
49
|
0.times do |i|
|
50
50
|
app.process("group_process_#{i}") do |process|
|
51
|
-
process.group = "
|
51
|
+
process.group = "group_1"
|
52
52
|
process.pid_file = "/Users/rohith/ffs/tmp/pids/mongrel_#{i}.pid"
|
53
53
|
process.start_command = "cd ~/ffs && mongrel_rails start -P #{process.pid_file} -p 3000 -d"
|
54
54
|
|
@@ -63,10 +63,9 @@ Bluepill.application(:sample_app) do |app|
|
|
63
63
|
|
64
64
|
1.times do |i|
|
65
65
|
app.process("group_process_#{i}") do |process|
|
66
|
-
process.start_command = "
|
66
|
+
process.start_command = "sleep 10"
|
67
67
|
process.daemonize = true
|
68
68
|
process.pid_file = "#{ROOT_DIR}/pids/process_#{i}.pid"
|
69
|
-
process.working_dir = '/tmp/somedir'
|
70
69
|
|
71
70
|
process.checks :always_true, :every => 10
|
72
71
|
end
|
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.0.
|
4
|
+
version: 0.0.19
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Arya Asemanfar
|
@@ -11,7 +11,7 @@ autorequire:
|
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
13
|
|
14
|
-
date: 2009-11-
|
14
|
+
date: 2009-11-12 00:00:00 -08:00
|
15
15
|
default_executable: bluepill
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|