Method: Flydata::Command::Sender#stop

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

#stop(options = {}) ⇒ Object



41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/flydata/command/sender.rb', line 41

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

  say('Stopping sender process.') unless options[:quiet]
  if Kernel.system("kill `cat #{FLYDATA_HOME}/flydata.pid`") and wait_until_client_stop(options)
    say('Done.') unless options[:quiet]
    return true
  end
  raise 'Something has gone wrong..'
end