Method: Flydata::Command::Sender#stop

Defined in:
lib/flydata/command/sender.rb

#stop(options = {}) ⇒ Object



85
86
87
88
89
90
91
92
93
94
95
96
97
# File 'lib/flydata/command/sender.rb', line 85

def stop(options = {})
  unless process_exist?
    log_info_stdout("Process doesn't exist.") unless options[:quiet]
    return true
  end

  log_info_stdout('Stopping sender process.') unless options[:quiet]
  if Kernel.system("kill `cat #{pid_file}`") and wait_until_client_stop(options)
    log_info_stdout('Done.') unless options[:quiet]
    return true
  end
  raise 'Failed to stop sender process.'
end