god 0.11.0 → 0.12.0
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/Announce.txt +6 -6
- data/Gemfile +2 -0
- data/History.txt +19 -2
- data/{README.txt → LICENSE} +0 -37
- data/README.md +31 -0
- data/Rakefile +80 -38
- data/bin/god +21 -21
- data/doc/god.asciidoc +1487 -0
- data/doc/intro.asciidoc +20 -0
- data/ext/god/extconf.rb +3 -3
- data/ext/god/kqueue_handler.c +18 -18
- data/ext/god/netlink_handler.c +31 -31
- data/god.gemspec +24 -16
- data/lib/god.rb +261 -204
- data/lib/god/behavior.rb +14 -14
- data/lib/god/behaviors/clean_pid_file.rb +5 -5
- data/lib/god/behaviors/clean_unix_socket.rb +10 -10
- data/lib/god/behaviors/notify_when_flapping.rb +12 -12
- data/lib/god/cli/command.rb +59 -46
- data/lib/god/cli/run.rb +33 -37
- data/lib/god/cli/version.rb +6 -6
- data/lib/god/compat19.rb +1 -4
- data/lib/god/condition.rb +21 -21
- data/lib/god/conditions/always.rb +19 -6
- data/lib/god/conditions/complex.rb +18 -18
- data/lib/god/conditions/cpu_usage.rb +14 -14
- data/lib/god/conditions/degrading_lambda.rb +8 -8
- data/lib/god/conditions/disk_usage.rb +5 -5
- data/lib/god/conditions/flapping.rb +23 -23
- data/lib/god/conditions/http_response_code.rb +35 -19
- data/lib/god/conditions/lambda.rb +2 -2
- data/lib/god/conditions/memory_usage.rb +13 -13
- data/lib/god/conditions/process_exits.rb +14 -20
- data/lib/god/conditions/process_running.rb +16 -25
- data/lib/god/conditions/socket_responding.rb +132 -0
- data/lib/god/conditions/tries.rb +10 -10
- data/lib/god/configurable.rb +10 -10
- data/lib/god/contact.rb +20 -20
- data/lib/god/contacts/email.rb +7 -4
- data/lib/god/contacts/jabber.rb +1 -1
- data/lib/god/driver.rb +96 -64
- data/lib/god/errors.rb +9 -9
- data/lib/god/event_handler.rb +19 -19
- data/lib/god/event_handlers/dummy_handler.rb +4 -4
- data/lib/god/event_handlers/kqueue_handler.rb +3 -3
- data/lib/god/event_handlers/netlink_handler.rb +2 -2
- data/lib/god/logger.rb +13 -13
- data/lib/god/metric.rb +50 -22
- data/lib/god/process.rb +53 -52
- data/lib/god/registry.rb +7 -7
- data/lib/god/simple_logger.rb +14 -14
- data/lib/god/socket.rb +11 -11
- data/lib/god/sugar.rb +30 -15
- data/lib/god/sys_logger.rb +2 -2
- data/lib/god/system/portable_poller.rb +8 -8
- data/lib/god/system/process.rb +8 -8
- data/lib/god/system/slash_proc_poller.rb +13 -13
- data/lib/god/task.rb +237 -188
- data/lib/god/timeline.rb +5 -5
- data/lib/god/trigger.rb +11 -11
- data/lib/god/watch.rb +205 -53
- data/test/configs/child_events/child_events.god +5 -5
- data/test/configs/child_events/simple_server.rb +1 -1
- data/test/configs/child_polls/child_polls.god +4 -4
- data/test/configs/child_polls/simple_server.rb +4 -4
- data/test/configs/complex/complex.god +7 -7
- data/test/configs/complex/simple_server.rb +1 -1
- data/test/configs/contact/contact.god +1 -1
- data/test/configs/contact/simple_server.rb +1 -1
- data/test/configs/daemon_events/daemon_events.god +5 -5
- data/test/configs/daemon_events/simple_server.rb +1 -1
- data/test/configs/daemon_events/simple_server_stop.rb +1 -1
- data/test/configs/daemon_polls/daemon_polls.god +3 -3
- data/test/configs/daemon_polls/simple_server.rb +1 -1
- data/test/configs/degrading_lambda/degrading_lambda.god +3 -3
- data/test/configs/keepalive/keepalive.god +9 -0
- data/test/configs/keepalive/keepalive.rb +12 -0
- data/test/configs/lifecycle/lifecycle.god +2 -2
- data/test/configs/matias/matias.god +6 -6
- data/test/configs/real.rb +7 -7
- data/test/configs/running_load/running_load.god +2 -2
- data/test/configs/stop_options/simple_server.rb +1 -1
- data/test/configs/stress/simple_server.rb +1 -1
- data/test/configs/stress/stress.god +2 -2
- data/test/configs/task/task.god +5 -5
- data/test/configs/test.rb +7 -7
- data/test/helper.rb +8 -8
- data/test/test_behavior.rb +3 -3
- data/test/test_campfire.rb +1 -2
- data/test/test_condition.rb +10 -10
- data/test/test_conditions_disk_usage.rb +12 -12
- data/test/test_conditions_http_response_code.rb +24 -24
- data/test/test_conditions_process_running.rb +7 -7
- data/test/test_conditions_socket_responding.rb +122 -0
- data/test/test_conditions_tries.rb +12 -12
- data/test/test_contact.rb +19 -19
- data/test/test_driver.rb +17 -3
- data/test/test_event_handler.rb +12 -12
- data/test/test_god.rb +195 -117
- data/test/test_handlers_kqueue_handler.rb +4 -4
- data/test/test_jabber.rb +1 -1
- data/test/test_logger.rb +17 -17
- data/test/test_metric.rb +16 -16
- data/test/test_process.rb +47 -41
- data/test/test_prowl.rb +1 -1
- data/test/test_registry.rb +2 -2
- data/test/test_socket.rb +3 -3
- data/test/test_sugar.rb +7 -7
- data/test/test_system_portable_poller.rb +1 -1
- data/test/test_system_process.rb +5 -5
- data/test/test_task.rb +57 -57
- data/test/test_timeline.rb +8 -8
- data/test/test_trigger.rb +16 -16
- data/test/test_watch.rb +69 -62
- metadata +182 -69
- data/lib/god/dependency_graph.rb +0 -41
- data/lib/god/diagnostics.rb +0 -37
- data/test/test_dependency_graph.rb +0 -62
data/Announce.txt
CHANGED
|
@@ -52,7 +52,7 @@ EXAMPLE
|
|
|
52
52
|
The easiest way to understand how god will make your life better is by looking at a sample config file. The following configuration file is what I use at gravatar.com to keep the mongrels running:
|
|
53
53
|
|
|
54
54
|
# run with: god -c /path/to/gravatar.god
|
|
55
|
-
#
|
|
55
|
+
#
|
|
56
56
|
# This is the actual config file used to keep the mongrels of
|
|
57
57
|
# gravatar.com running.
|
|
58
58
|
|
|
@@ -61,7 +61,7 @@ RAILS_ROOT = "/Users/tom/dev/gravatar2"
|
|
|
61
61
|
%w{8200 8201 8202}.each do |port|
|
|
62
62
|
God.watch do |w|
|
|
63
63
|
w.name = "gravatar2-mongrel-#{port}"
|
|
64
|
-
w.interval = 30.seconds # default
|
|
64
|
+
w.interval = 30.seconds # default
|
|
65
65
|
w.start = "mongrel_rails start -c #{RAILS_ROOT} -p #{port} \
|
|
66
66
|
-P #{RAILS_ROOT}/log/mongrel.#{port}.pid -d"
|
|
67
67
|
w.stop = "mongrel_rails stop -P #{RAILS_ROOT}/log/mongrel.#{port}.pid"
|
|
@@ -69,7 +69,7 @@ RAILS_ROOT = "/Users/tom/dev/gravatar2"
|
|
|
69
69
|
w.start_grace = 10.seconds
|
|
70
70
|
w.restart_grace = 10.seconds
|
|
71
71
|
w.pid_file = File.join(RAILS_ROOT, "log/mongrel.#{port}.pid")
|
|
72
|
-
|
|
72
|
+
|
|
73
73
|
w.behavior(:clean_pid_file)
|
|
74
74
|
|
|
75
75
|
w.start_if do |start|
|
|
@@ -78,19 +78,19 @@ RAILS_ROOT = "/Users/tom/dev/gravatar2"
|
|
|
78
78
|
c.running = false
|
|
79
79
|
end
|
|
80
80
|
end
|
|
81
|
-
|
|
81
|
+
|
|
82
82
|
w.restart_if do |restart|
|
|
83
83
|
restart.condition(:memory_usage) do |c|
|
|
84
84
|
c.above = 150.megabytes
|
|
85
85
|
c.times = [3, 5] # 3 out of 5 intervals
|
|
86
86
|
end
|
|
87
|
-
|
|
87
|
+
|
|
88
88
|
restart.condition(:cpu_usage) do |c|
|
|
89
89
|
c.above = 50.percent
|
|
90
90
|
c.times = 5
|
|
91
91
|
end
|
|
92
92
|
end
|
|
93
|
-
|
|
93
|
+
|
|
94
94
|
# lifecycle
|
|
95
95
|
w.lifecycle do |on|
|
|
96
96
|
on.condition(:flapping) do |c|
|
data/Gemfile
ADDED
data/History.txt
CHANGED
|
@@ -1,3 +1,20 @@
|
|
|
1
|
+
== 0.12.0
|
|
2
|
+
* Minor Enhancements
|
|
3
|
+
* Add umask support
|
|
4
|
+
* Add socket response condition (#25)
|
|
5
|
+
* Don't require tests run as sudo under non-linux systems (#15)
|
|
6
|
+
* Add Bundler support
|
|
7
|
+
* Add keepalive simple conditional setups (#71)
|
|
8
|
+
* Better load command to act upon removed watches (#70)
|
|
9
|
+
* Add support for ssl in http_response_code condition (#36)
|
|
10
|
+
* New documentation at http://godrb.com
|
|
11
|
+
* Bug Fixes
|
|
12
|
+
* Use IO.print instead of IO.puts for thread safety (#35)
|
|
13
|
+
* Fix Slashproc poller for commands with spaces (#31)
|
|
14
|
+
* Various segfault and kernel panic fixes
|
|
15
|
+
* Fix SMTP Auth documentation (#29)
|
|
16
|
+
* Fix a bunch of tests that were failing on Ruby 1.9
|
|
17
|
+
|
|
1
18
|
== 0.11.0 / 2010-07-01
|
|
2
19
|
* Major Changes
|
|
3
20
|
* Rewrite notification system to be more consistent and flexible.
|
|
@@ -119,7 +136,7 @@
|
|
|
119
136
|
* Major Enhancements
|
|
120
137
|
* Enable sending of arbitrary signals to a task or group via `god signal`
|
|
121
138
|
* Bug Fixes
|
|
122
|
-
* setup logging *after* loading a given config file when daemonized.
|
|
139
|
+
* setup logging *after* loading a given config file when daemonized.
|
|
123
140
|
enables logging to the 'God.log_file' specified in a config file. [github.com/jnewland]
|
|
124
141
|
* New Conditions
|
|
125
142
|
* FileMtime < PollCondition - trigger on file mtime durations [github.com/jwilkins]
|
|
@@ -274,7 +291,7 @@
|
|
|
274
291
|
|
|
275
292
|
* Minor Enhancement
|
|
276
293
|
* Allow extra args to pass through to config file
|
|
277
|
-
|
|
294
|
+
|
|
278
295
|
== 0.5.1 / 2007-10-08
|
|
279
296
|
|
|
280
297
|
* Bug Fixes
|
data/{README.txt → LICENSE}
RENAMED
|
@@ -1,40 +1,3 @@
|
|
|
1
|
-
god
|
|
2
|
-
by Tom Preston-Werner
|
|
3
|
-
Kevin Clark (kqueue/netlink support)
|
|
4
|
-
|
|
5
|
-
http://god.rubyforge.org
|
|
6
|
-
|
|
7
|
-
== DESCRIPTION:
|
|
8
|
-
|
|
9
|
-
God is an easy to configure, easy to extend monitoring framework written
|
|
10
|
-
in Ruby.
|
|
11
|
-
|
|
12
|
-
Keeping your server processes and tasks running should be a simple part of
|
|
13
|
-
your deployment process. God aims to be the simplest, most powerful
|
|
14
|
-
monitoring application available.
|
|
15
|
-
|
|
16
|
-
== DOCUMENTATION:
|
|
17
|
-
|
|
18
|
-
See online documentation at http://god.rubyforge.org
|
|
19
|
-
|
|
20
|
-
== COMMUNITY:
|
|
21
|
-
|
|
22
|
-
Sign up for the god mailing list at http://groups.google.com/group/god-rb
|
|
23
|
-
|
|
24
|
-
== INSTALL:
|
|
25
|
-
|
|
26
|
-
$ sudo gem install god
|
|
27
|
-
|
|
28
|
-
== CONTRIBUTE:
|
|
29
|
-
|
|
30
|
-
Latest code is available at http://github.com/mojombo/god
|
|
31
|
-
|
|
32
|
-
The 'master' branch can be cloned with:
|
|
33
|
-
|
|
34
|
-
$ git clone git://github.com/mojombo/god.git
|
|
35
|
-
|
|
36
|
-
== LICENSE:
|
|
37
|
-
|
|
38
1
|
(The MIT License)
|
|
39
2
|
|
|
40
3
|
Copyright (c) 2007 Tom Preston-Werner
|
data/README.md
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
God: The Ruby Framework for Process Management
|
|
2
|
+
==============================================
|
|
3
|
+
|
|
4
|
+
* Authors: Tom Preston-Werner, Kevin Clark, Eric Lindval
|
|
5
|
+
* Website: http://godrb.com
|
|
6
|
+
|
|
7
|
+
Description
|
|
8
|
+
-----------
|
|
9
|
+
|
|
10
|
+
God is an easy to configure, easy to extend monitoring framework written in
|
|
11
|
+
Ruby.
|
|
12
|
+
|
|
13
|
+
Keeping your server processes and tasks running should be a simple part of
|
|
14
|
+
your deployment process. God aims to be the simplest, most powerful monitoring
|
|
15
|
+
application available.
|
|
16
|
+
|
|
17
|
+
Documentation
|
|
18
|
+
-------------
|
|
19
|
+
|
|
20
|
+
See in-repo documentation at `REPO_ROOT/doc`.
|
|
21
|
+
See online documentation at http://godrb.com.
|
|
22
|
+
|
|
23
|
+
Community
|
|
24
|
+
---------
|
|
25
|
+
|
|
26
|
+
Sign up for the god mailing list at http://groups.google.com/group/god-rb
|
|
27
|
+
|
|
28
|
+
License
|
|
29
|
+
-------
|
|
30
|
+
|
|
31
|
+
See LICENSE file.
|
data/Rakefile
CHANGED
|
@@ -1,32 +1,41 @@
|
|
|
1
1
|
require 'rubygems'
|
|
2
2
|
require 'rake'
|
|
3
|
+
require 'rdoc/task'
|
|
3
4
|
require 'date'
|
|
4
5
|
|
|
5
|
-
#############################################################################
|
|
6
|
-
#
|
|
7
|
-
# The name of the package
|
|
8
|
-
#
|
|
9
|
-
#############################################################################
|
|
10
|
-
|
|
11
|
-
NAME = 'god'
|
|
12
|
-
|
|
13
6
|
#############################################################################
|
|
14
7
|
#
|
|
15
8
|
# Helper functions
|
|
16
9
|
#
|
|
17
10
|
#############################################################################
|
|
18
11
|
|
|
19
|
-
def
|
|
20
|
-
|
|
12
|
+
def name
|
|
13
|
+
@name ||= Dir['*.gemspec'].first.split('.').first
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def version
|
|
17
|
+
line = File.read("lib/#{name}.rb")[/^\s*VERSION\s*=\s*.*/]
|
|
21
18
|
line.match(/.*VERSION\s*=\s*['"](.*)['"]/)[1]
|
|
22
19
|
end
|
|
23
20
|
|
|
21
|
+
def date
|
|
22
|
+
Date.today.to_s
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def rubyforge_project
|
|
26
|
+
name
|
|
27
|
+
end
|
|
28
|
+
|
|
24
29
|
def gemspec_file
|
|
25
|
-
"#{
|
|
30
|
+
"#{name}.gemspec"
|
|
26
31
|
end
|
|
27
32
|
|
|
28
33
|
def gem_file
|
|
29
|
-
"#{
|
|
34
|
+
"#{name}-#{version}.gem"
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def replace_header(head, header_name)
|
|
38
|
+
head.sub!(/(\.#{header_name}\s*= ').*'/) { "#{$1}#{send(header_name)}'"}
|
|
30
39
|
end
|
|
31
40
|
|
|
32
41
|
#############################################################################
|
|
@@ -44,7 +53,7 @@ Rake::TestTask.new(:test) do |test|
|
|
|
44
53
|
test.verbose = true
|
|
45
54
|
end
|
|
46
55
|
|
|
47
|
-
desc "Generate and open
|
|
56
|
+
desc "Generate RCov test coverage and open in your browser"
|
|
48
57
|
task :coverage do
|
|
49
58
|
require 'rcov'
|
|
50
59
|
sh "rm -fr coverage"
|
|
@@ -52,17 +61,17 @@ task :coverage do
|
|
|
52
61
|
sh "open coverage/index.html"
|
|
53
62
|
end
|
|
54
63
|
|
|
55
|
-
require '
|
|
64
|
+
require 'rdoc/task'
|
|
56
65
|
Rake::RDocTask.new do |rdoc|
|
|
57
66
|
rdoc.rdoc_dir = 'rdoc'
|
|
58
|
-
rdoc.title = "#{
|
|
67
|
+
rdoc.title = "#{name} #{version}"
|
|
59
68
|
rdoc.rdoc_files.include('README*')
|
|
60
69
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
|
61
70
|
end
|
|
62
71
|
|
|
63
72
|
desc "Open an irb session preloaded with this library"
|
|
64
73
|
task :console do
|
|
65
|
-
sh "irb -rubygems -r ./lib/#{
|
|
74
|
+
sh "irb -rubygems -r ./lib/#{name}.rb"
|
|
66
75
|
end
|
|
67
76
|
|
|
68
77
|
#############################################################################
|
|
@@ -72,7 +81,7 @@ end
|
|
|
72
81
|
#############################################################################
|
|
73
82
|
|
|
74
83
|
desc "Upload site to Rubyforge"
|
|
75
|
-
task :
|
|
84
|
+
task :site_old do
|
|
76
85
|
sh "scp -r site/* mojombo@god.rubyforge.org:/var/www/gforge-projects/god"
|
|
77
86
|
end
|
|
78
87
|
|
|
@@ -81,44 +90,89 @@ task :site_edge do
|
|
|
81
90
|
sh "scp -r site/* mojombo@god.rubyforge.org:/var/www/gforge-projects/god/edge"
|
|
82
91
|
end
|
|
83
92
|
|
|
93
|
+
desc "Generate the new-style site"
|
|
94
|
+
task :site do
|
|
95
|
+
# Generate the dynamic parts of the site.
|
|
96
|
+
puts "Generating dynamic..."
|
|
97
|
+
require 'gollum'
|
|
98
|
+
wiki = Gollum::Wiki.new('.', :base_path => '/doc')
|
|
99
|
+
html = wiki.page('god', 'HEAD').formatted_data.gsub("\342\200\231", "'")
|
|
100
|
+
template = File.read('./site/index.template.html')
|
|
101
|
+
index = template.sub("{{ content }}", html)
|
|
102
|
+
File.open('./site/index.html', 'w') do |f|
|
|
103
|
+
f.write(index)
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
puts "Done. Opening in browser..."
|
|
107
|
+
sh "open site/index.html"
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
desc "Generate the new-style site"
|
|
111
|
+
task :site_release do
|
|
112
|
+
# Ensure the gh-pages dir exists so we can generate into it.
|
|
113
|
+
puts "Checking for gh-pages dir..."
|
|
114
|
+
unless File.exist?("./gh-pages")
|
|
115
|
+
puts "No gh-pages directory found. Run the following commands first:"
|
|
116
|
+
puts " `git clone git@github.com:mojombo/god gh-pages"
|
|
117
|
+
puts " `cd gh-pages"
|
|
118
|
+
puts " `git checkout gh-pages`"
|
|
119
|
+
exit(1)
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
# Copy the rest of the site over.
|
|
123
|
+
puts "Copying static..."
|
|
124
|
+
sh "cp -R site/* gh-pages/"
|
|
125
|
+
|
|
126
|
+
# Commit the changes
|
|
127
|
+
sha = `git log`.match(/[a-z0-9]{40}/)[0]
|
|
128
|
+
sh "cd gh-pages && git add . && git commit -m 'Updating to #{sha}.' && git push"
|
|
129
|
+
puts 'Done.'
|
|
130
|
+
end
|
|
84
131
|
#############################################################################
|
|
85
132
|
#
|
|
86
133
|
# Packaging tasks
|
|
87
134
|
#
|
|
88
135
|
#############################################################################
|
|
89
136
|
|
|
137
|
+
desc "Create tag v#{version} and build and push #{gem_file} to Rubygems"
|
|
90
138
|
task :release => :build do
|
|
91
139
|
unless `git branch` =~ /^\* master$/
|
|
92
140
|
puts "You must be on the master branch to release!"
|
|
93
141
|
exit!
|
|
94
142
|
end
|
|
95
|
-
sh "git commit --allow-empty -a -m '
|
|
96
|
-
sh "git tag v#{
|
|
97
|
-
sh "git push origin master
|
|
98
|
-
sh "
|
|
143
|
+
sh "git commit --allow-empty -a -m 'Release #{version}'"
|
|
144
|
+
sh "git tag v#{version}"
|
|
145
|
+
sh "git push origin master"
|
|
146
|
+
sh "git push origin v#{version}"
|
|
147
|
+
sh "gem push pkg/#{name}-#{version}.gem"
|
|
99
148
|
end
|
|
100
149
|
|
|
150
|
+
desc "Build #{gem_file} into the pkg directory"
|
|
101
151
|
task :build => :gemspec do
|
|
102
152
|
sh "mkdir -p pkg"
|
|
103
153
|
sh "gem build #{gemspec_file}"
|
|
104
154
|
sh "mv #{gem_file} pkg"
|
|
105
155
|
end
|
|
106
156
|
|
|
107
|
-
|
|
157
|
+
desc "Generate #{gemspec_file}"
|
|
158
|
+
task :gemspec do
|
|
108
159
|
# read spec file and split out manifest section
|
|
109
160
|
spec = File.read(gemspec_file)
|
|
110
161
|
head, manifest, tail = spec.split(" # = MANIFEST =\n")
|
|
111
162
|
|
|
112
|
-
# replace version and date
|
|
113
|
-
head
|
|
114
|
-
head
|
|
163
|
+
# replace name version and date
|
|
164
|
+
replace_header(head, :name)
|
|
165
|
+
replace_header(head, :version)
|
|
166
|
+
replace_header(head, :date)
|
|
167
|
+
#comment this out if your rubyforge_project has a different name
|
|
168
|
+
replace_header(head, :rubyforge_project)
|
|
115
169
|
|
|
116
170
|
# determine file list from git ls-files
|
|
117
171
|
files = `git ls-files`.
|
|
118
172
|
split("\n").
|
|
119
173
|
sort.
|
|
120
174
|
reject { |file| file =~ /^\./ }.
|
|
121
|
-
reject { |file| file =~ /^(examples|ideas|init|site)/ }.
|
|
175
|
+
reject { |file| file =~ /^(rdoc|pkg|examples|ideas|init|site)/ }.
|
|
122
176
|
map { |file| " #{file}" }.
|
|
123
177
|
join("\n")
|
|
124
178
|
|
|
@@ -128,15 +182,3 @@ task :gemspec => :validate do
|
|
|
128
182
|
File.open(gemspec_file, 'w') { |io| io.write(spec) }
|
|
129
183
|
puts "Updated #{gemspec_file}"
|
|
130
184
|
end
|
|
131
|
-
|
|
132
|
-
task :validate do
|
|
133
|
-
libfiles = Dir['lib/*'] - ["lib/#{NAME}.rb", "lib/#{NAME}"]
|
|
134
|
-
unless libfiles.empty?
|
|
135
|
-
puts "Directory `lib` should only contain a `#{NAME}.rb` file and `#{NAME}` dir."
|
|
136
|
-
exit!
|
|
137
|
-
end
|
|
138
|
-
unless Dir['VERSION*'].empty?
|
|
139
|
-
puts "A `VERSION` file at root level violates Gem best practices."
|
|
140
|
-
exit!
|
|
141
|
-
end
|
|
142
|
-
end
|
data/bin/god
CHANGED
|
@@ -20,13 +20,13 @@ begin
|
|
|
20
20
|
Usage:
|
|
21
21
|
Starting:
|
|
22
22
|
god [-c <config file>] [-p <port> | -b] [-P <file>] [-l <file>] [-D]
|
|
23
|
-
|
|
23
|
+
|
|
24
24
|
Querying:
|
|
25
25
|
god <command> <argument> [-p <port>]
|
|
26
26
|
god <command> [-p <port>]
|
|
27
27
|
god -v
|
|
28
28
|
god -V (must be run as root to be accurate on Linux)
|
|
29
|
-
|
|
29
|
+
|
|
30
30
|
Commands:
|
|
31
31
|
start <task or group name> start task or group
|
|
32
32
|
restart <task or group name> restart task or group
|
|
@@ -34,77 +34,77 @@ begin
|
|
|
34
34
|
monitor <task or group name> monitor task or group
|
|
35
35
|
unmonitor <task or group name> unmonitor task or group
|
|
36
36
|
remove <task or group name> remove task or group from god
|
|
37
|
-
load <file>
|
|
37
|
+
load <file> [action] load a config into a running god
|
|
38
38
|
log <task name> show realtime log for given task
|
|
39
39
|
status [task or group name] show status
|
|
40
40
|
signal <task or group name> <sig> signal all matching tasks
|
|
41
41
|
quit stop god
|
|
42
42
|
terminate stop god and all tasks
|
|
43
43
|
check run self diagnostic
|
|
44
|
-
|
|
44
|
+
|
|
45
45
|
Options:
|
|
46
46
|
EOF
|
|
47
|
-
|
|
47
|
+
|
|
48
48
|
opts.on("-cCONFIG", "--config-file CONFIG", "Configuration file") do |x|
|
|
49
49
|
options[:config] = x
|
|
50
50
|
end
|
|
51
|
-
|
|
51
|
+
|
|
52
52
|
opts.on("-pPORT", "--port PORT", "Communications port (default 17165)") do |x|
|
|
53
53
|
options[:port] = x
|
|
54
54
|
end
|
|
55
|
-
|
|
55
|
+
|
|
56
56
|
opts.on("-b", "--auto-bind", "Auto-bind to an unused port number") do
|
|
57
57
|
options[:port] = "0"
|
|
58
58
|
end
|
|
59
|
-
|
|
59
|
+
|
|
60
60
|
opts.on("-PFILE", "--pid FILE", "Where to write the PID file") do |x|
|
|
61
61
|
options[:pid] = x
|
|
62
62
|
end
|
|
63
|
-
|
|
63
|
+
|
|
64
64
|
opts.on("-lFILE", "--log FILE", "Where to write the log file") do |x|
|
|
65
65
|
options[:log] = x
|
|
66
66
|
end
|
|
67
|
-
|
|
67
|
+
|
|
68
68
|
opts.on("-D", "--no-daemonize", "Don't daemonize") do
|
|
69
69
|
options[:daemonize] = false
|
|
70
70
|
end
|
|
71
|
-
|
|
71
|
+
|
|
72
72
|
opts.on("-v", "--version", "Print the version number and exit") do
|
|
73
73
|
options[:version] = true
|
|
74
74
|
end
|
|
75
|
-
|
|
75
|
+
|
|
76
76
|
opts.on("-V", "Print extended version and build information") do
|
|
77
77
|
options[:info] = true
|
|
78
78
|
end
|
|
79
|
-
|
|
79
|
+
|
|
80
80
|
opts.on("--log-level LEVEL", "Log level [debug|info|warn|error|fatal]") do |x|
|
|
81
81
|
options[:log_level] = x.to_sym
|
|
82
82
|
end
|
|
83
|
-
|
|
83
|
+
|
|
84
84
|
opts.on("--no-syslog", "Disable output to syslog") do
|
|
85
85
|
options[:syslog] = false
|
|
86
86
|
end
|
|
87
|
-
|
|
87
|
+
|
|
88
88
|
opts.on("--attach PID", "Quit god when the attached process dies") do |x|
|
|
89
89
|
options[:attach] = x
|
|
90
90
|
end
|
|
91
|
-
|
|
91
|
+
|
|
92
92
|
opts.on("--no-events", "Disable the event system") do
|
|
93
93
|
options[:events] = false
|
|
94
94
|
end
|
|
95
|
-
|
|
95
|
+
|
|
96
96
|
opts.on("--bleakhouse", "Enable bleakhouse profiling") do
|
|
97
97
|
options[:bleakhouse] = true
|
|
98
98
|
end
|
|
99
99
|
end
|
|
100
|
-
|
|
100
|
+
|
|
101
101
|
opts.parse!
|
|
102
|
-
|
|
102
|
+
|
|
103
103
|
# validate
|
|
104
104
|
if options[:log_level] && ![:debug, :info, :warn, :error, :fatal].include?(options[:log_level])
|
|
105
105
|
abort("Invalid log level '#{options[:log_level]}'")
|
|
106
106
|
end
|
|
107
|
-
|
|
107
|
+
|
|
108
108
|
# dispatch
|
|
109
109
|
if !options[:config] && options[:version]
|
|
110
110
|
require 'god'
|
|
@@ -129,4 +129,4 @@ rescue Exception => e
|
|
|
129
129
|
puts e.message
|
|
130
130
|
puts e.backtrace.join("\n")
|
|
131
131
|
end
|
|
132
|
-
end
|
|
132
|
+
end
|