resurrected_god 1.1.1 → 1.1.2
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.
- checksums.yaml +4 -4
- data/History.md +5 -0
- data/ext/god/kqueue_handler.c +2 -1
- data/ext/god/netlink_handler.c +2 -1
- data/lib/god/cli/run.rb +2 -2
- data/lib/god/conditions/complex.rb +3 -3
- data/lib/god/conditions/cpu_usage.rb +1 -1
- data/lib/god/conditions/memory_usage.rb +1 -1
- data/lib/god/contact.rb +2 -2
- data/lib/god/logger.rb +2 -2
- data/lib/god/process.rb +4 -4
- data/lib/god/system/slash_proc_poller.rb +1 -1
- data/lib/god/version.rb +1 -1
- data/lib/god/watch.rb +1 -0
- data/lib/god.rb +3 -4
- metadata +4 -7
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c7465cd872f35560c971fa2a4a0d1571b37129d7012d309f9e76b37bdb4e07e4
|
|
4
|
+
data.tar.gz: 33fec16027eaccb0df55a0895ea139ceed978e98f8c868596e00bfa2ca87bff1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0ef0c4e6171d31c292a8f9b76f7d813f434c31de284a6fef9fafe947226c807d5110f7e604dd1fc950d9f33c35cd4bd3c485c00e9498ccb51942915829d1dbb3
|
|
7
|
+
data.tar.gz: 2c831bfd22c3887c9445fe22d15eb6ccfb3787b3b61bdbf40170e6497b305704d6dfac5cb897f72a5b7e4a5e7f8d2890675cb481e7e7e13cde13467e62d57c63
|
data/History.md
CHANGED
data/ext/god/kqueue_handler.c
CHANGED
data/ext/god/netlink_handler.c
CHANGED
data/lib/god/cli/run.rb
CHANGED
|
@@ -111,13 +111,13 @@ module God
|
|
|
111
111
|
def setup_logging
|
|
112
112
|
log_file = God.log_file
|
|
113
113
|
log_file = File.expand_path(@options[:log]) if @options[:log]
|
|
114
|
-
log_file =
|
|
114
|
+
log_file = File::NULL if !log_file && @options[:daemonize]
|
|
115
115
|
return unless log_file
|
|
116
116
|
|
|
117
117
|
puts "Sending output to log file: #{log_file}" unless @options[:daemonize]
|
|
118
118
|
|
|
119
119
|
# reset file descriptors
|
|
120
|
-
$stdin.reopen
|
|
120
|
+
$stdin.reopen File::NULL
|
|
121
121
|
$stdout.reopen(log_file, 'a')
|
|
122
122
|
$stderr.reopen $stdout
|
|
123
123
|
$stdout.sync = true
|
|
@@ -64,15 +64,15 @@ module God
|
|
|
64
64
|
# nil @this here by initially setting res to true or false,
|
|
65
65
|
# depending on whether the first operator used is AND or OR
|
|
66
66
|
# respectively.
|
|
67
|
-
@op_stack[0]
|
|
67
|
+
@op_stack[0].anybits?(AND)
|
|
68
68
|
else
|
|
69
69
|
@this.test
|
|
70
70
|
end
|
|
71
71
|
|
|
72
72
|
@op_stack.each do |op|
|
|
73
73
|
cond = @oper_stack.shift
|
|
74
|
-
value = op
|
|
75
|
-
if op
|
|
74
|
+
value = op.anybits?(NOT) ? !cond.test : cond.test
|
|
75
|
+
if op.anybits?(AND)
|
|
76
76
|
res &&= value
|
|
77
77
|
else
|
|
78
78
|
res ||= value
|
|
@@ -64,7 +64,7 @@ module God
|
|
|
64
64
|
@timeline.push(process.percent_cpu)
|
|
65
65
|
self.info = []
|
|
66
66
|
|
|
67
|
-
history = @timeline.map { |x| "#{x > above
|
|
67
|
+
history = @timeline.map { |x| "#{'*' if x > above}#{x}%%" }.join(', ')
|
|
68
68
|
|
|
69
69
|
if @timeline.count { |x| x > above } >= times.first
|
|
70
70
|
self.info = "cpu out of bounds [#{history}]"
|
|
@@ -66,7 +66,7 @@ module God
|
|
|
66
66
|
@timeline.push(process.memory)
|
|
67
67
|
self.info = []
|
|
68
68
|
|
|
69
|
-
history = @timeline.map { |x| "#{x > above
|
|
69
|
+
history = @timeline.map { |x| "#{'*' if x > above}#{x}kb" }.join(', ')
|
|
70
70
|
|
|
71
71
|
if @timeline.count { |x| x > above } >= times.first
|
|
72
72
|
self.info = "memory out of bounds [#{history}]"
|
data/lib/god/contact.rb
CHANGED
|
@@ -47,7 +47,7 @@ module God
|
|
|
47
47
|
when String
|
|
48
48
|
{ contacts: Array(spec) }
|
|
49
49
|
when Array
|
|
50
|
-
raise ArgumentError, 'contains non-String elements' unless spec.all?
|
|
50
|
+
raise ArgumentError, 'contains non-String elements' unless spec.all?(String)
|
|
51
51
|
|
|
52
52
|
{ contacts: spec }
|
|
53
53
|
when Hash
|
|
@@ -60,7 +60,7 @@ module God
|
|
|
60
60
|
when String
|
|
61
61
|
# valid
|
|
62
62
|
when Array
|
|
63
|
-
raise ArgumentError, 'has a :contacts key containing non-String elements' unless contacts.all?
|
|
63
|
+
raise ArgumentError, 'has a :contacts key containing non-String elements' unless contacts.all?(String)
|
|
64
64
|
# valid
|
|
65
65
|
else
|
|
66
66
|
raise ArgumentError, 'must have a :contacts key pointing to a String or Array of Strings'
|
data/lib/god/logger.rb
CHANGED
|
@@ -12,7 +12,7 @@ module God
|
|
|
12
12
|
|
|
13
13
|
# Instantiate a new Logger object
|
|
14
14
|
def initialize(io = $stdout)
|
|
15
|
-
super
|
|
15
|
+
super
|
|
16
16
|
self.logs = {}
|
|
17
17
|
@mutex = Mutex.new
|
|
18
18
|
@capture = nil
|
|
@@ -24,7 +24,7 @@ module God
|
|
|
24
24
|
|
|
25
25
|
def level=(lev)
|
|
26
26
|
SysLogger.level = SimpleLogger::CONSTANT_TO_SYMBOL[lev] if Logger.syslog
|
|
27
|
-
super
|
|
27
|
+
super
|
|
28
28
|
end
|
|
29
29
|
|
|
30
30
|
# Log a message
|
data/lib/god/process.rb
CHANGED
|
@@ -9,7 +9,7 @@ module God
|
|
|
9
9
|
:stop_timeout, :stop_signal, :umask
|
|
10
10
|
|
|
11
11
|
def initialize
|
|
12
|
-
self.log =
|
|
12
|
+
self.log = File::NULL
|
|
13
13
|
|
|
14
14
|
@pid_file = nil
|
|
15
15
|
@tracking_pid = true
|
|
@@ -139,7 +139,7 @@ module God
|
|
|
139
139
|
applog(self, :error, "CHROOT directory '#{chroot}' does not exist")
|
|
140
140
|
end
|
|
141
141
|
|
|
142
|
-
unless File.exist?(File.join(chroot,
|
|
142
|
+
unless File.exist?(File.join(chroot, File::NULL))
|
|
143
143
|
valid = false
|
|
144
144
|
applog(self, :error, "CHROOT directory '#{chroot}' does not contain '/dev/null'")
|
|
145
145
|
end
|
|
@@ -309,9 +309,9 @@ module God
|
|
|
309
309
|
::Process::Sys.setgid(gid_num) if gid_num
|
|
310
310
|
::Process::Sys.setuid(uid_num) if uid
|
|
311
311
|
self.dir ||= '/'
|
|
312
|
-
Dir.chdir
|
|
312
|
+
Dir.chdir dir
|
|
313
313
|
$0 = command
|
|
314
|
-
$stdin.reopen
|
|
314
|
+
$stdin.reopen File::NULL
|
|
315
315
|
if log_cmd
|
|
316
316
|
$stdout.reopen IO.popen(log_cmd, 'a')
|
|
317
317
|
else
|
data/lib/god/version.rb
CHANGED
data/lib/god/watch.rb
CHANGED
|
@@ -27,6 +27,7 @@ module God
|
|
|
27
27
|
|
|
28
28
|
# Public: God::Process delegators. See lib/god/process.rb for docs.
|
|
29
29
|
extend Forwardable
|
|
30
|
+
|
|
30
31
|
def_delegators :@process, :name, :uid, :gid, :start, :stop, :restart, :dir,
|
|
31
32
|
:name=, :uid=, :gid=, :start=, :stop=, :restart=,
|
|
32
33
|
:dir=, :pid_file, :pid_file=, :log, :log=,
|
data/lib/god.rb
CHANGED
|
@@ -243,7 +243,7 @@ if $load_god
|
|
|
243
243
|
warn: Logger::WARN,
|
|
244
244
|
error: Logger::ERROR,
|
|
245
245
|
fatal: Logger::FATAL }
|
|
246
|
-
LOG.level = log_level_map[
|
|
246
|
+
LOG.level = log_level_map[log_level]
|
|
247
247
|
|
|
248
248
|
# Init has been executed.
|
|
249
249
|
self.inited = true
|
|
@@ -514,8 +514,7 @@ if $load_god
|
|
|
514
514
|
# Returns an Array of String names of the tasks affected.
|
|
515
515
|
def self.signal(name, signal)
|
|
516
516
|
items = watches_by_name(name)
|
|
517
|
-
jobs =
|
|
518
|
-
items.each { |w| jobs << Thread.new { w.signal(signal) } }
|
|
517
|
+
jobs = items.map { |w| Thread.new { w.signal(signal) } }
|
|
519
518
|
jobs.each(&:join)
|
|
520
519
|
items.map(&:name)
|
|
521
520
|
end
|
|
@@ -676,7 +675,7 @@ if $load_god
|
|
|
676
675
|
internal_init
|
|
677
676
|
|
|
678
677
|
# Instantiate server.
|
|
679
|
-
self.server = Socket.new(
|
|
678
|
+
self.server = Socket.new(port, socket_user, socket_group, socket_perms)
|
|
680
679
|
|
|
681
680
|
# Start monitoring any watches set to autostart.
|
|
682
681
|
watches.each_value { |w| w.monitor if w.autostart? }
|
metadata
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: resurrected_god
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.1.
|
|
4
|
+
version: 1.1.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Tom Preston-Werner
|
|
8
8
|
- Kevin Clark
|
|
9
9
|
- Eric Lindvall
|
|
10
10
|
- mishina2228
|
|
11
|
-
autorequire:
|
|
12
11
|
bindir: bin
|
|
13
12
|
cert_chain: []
|
|
14
|
-
date:
|
|
13
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
15
14
|
dependencies:
|
|
16
15
|
- !ruby/object:Gem::Dependency
|
|
17
16
|
name: drb
|
|
@@ -119,8 +118,7 @@ metadata:
|
|
|
119
118
|
changelog_uri: https://github.com/mishina2228/resurrected_god/blob/master/History.md
|
|
120
119
|
homepage_uri: https://github.com/mishina2228/resurrected_god
|
|
121
120
|
rubygems_mfa_required: 'true'
|
|
122
|
-
source_code_uri: https://github.com/mishina2228/resurrected_god/tree/v1.1.
|
|
123
|
-
post_install_message:
|
|
121
|
+
source_code_uri: https://github.com/mishina2228/resurrected_god/tree/v1.1.2
|
|
124
122
|
rdoc_options: []
|
|
125
123
|
require_paths:
|
|
126
124
|
- lib
|
|
@@ -136,8 +134,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
136
134
|
- !ruby/object:Gem::Version
|
|
137
135
|
version: '0'
|
|
138
136
|
requirements: []
|
|
139
|
-
rubygems_version:
|
|
140
|
-
signing_key:
|
|
137
|
+
rubygems_version: 4.0.3
|
|
141
138
|
specification_version: 4
|
|
142
139
|
summary: Process monitoring framework.
|
|
143
140
|
test_files: []
|