Method: Flydata::Command::Sender#restart

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

#restart(options = {}) ⇒ Object



73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/flydata/command/sender.rb', line 73

def restart(options = {})
  if process_exist?
    say('Restarting sender process.') unless options[:quiet]
    if Kernel.system("kill -HUP `cat #{FLYDATA_HOME}/flydata.pid`")
      say('Done.') unless options[:quiet]
      return true
    else
      raise 'Something has gone wrong..'
    end
  else
    say("Process doesn't exist.") unless options[:quiet]
    start(options)
  end
end