Module: Fluentd::Agent::ProcessOperation
- Defined in:
- app/models/fluentd/agent/process_operation.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(base) ⇒ Object
4 5 6 7 8 |
# File 'app/models/fluentd/agent/process_operation.rb', line 4 def self.included(base) define_method(:dryrun!) do raise NotImplementedError, "'dryrun!' method is required to be defined" end end |
Instance Method Details
#dryrun(file_path = nil) ⇒ Object
19 20 21 22 23 24 |
# File 'app/models/fluentd/agent/process_operation.rb', line 19 def dryrun(file_path = nil) dryrun!(file_path) true rescue ::Fluentd::Agent::ConfigError false end |
#pid ⇒ Object
26 27 28 29 30 |
# File 'app/models/fluentd/agent/process_operation.rb', line 26 def pid return unless File.exists?(pid_file) return if File.zero?(pid_file) File.read(pid_file).to_i rescue nil end |
#running? ⇒ Boolean
10 11 12 13 14 15 16 17 |
# File 'app/models/fluentd/agent/process_operation.rb', line 10 def running? begin pid && Process.kill(0, pid) rescue Errno::ESRCH File.unlink(pid_file) # no needed any more false end end |