module Flydata module Command class Sender < Base FLYDATA_HOME=Flydata::HOME_DIR def start # Check if process exist if process_exist? say("Process exist. Please stop process first.") return end wait_until_server_ready # Start sender(fluentd) process say('Starting sender process.') Dir.chdir(FLYDATA_HOME){ system("fluentd -d #{FLYDATA_HOME}/flydata.pid -l #{FLYDATA_HOME}/flydata.log -c #{FLYDATA_HOME}/flydata.conf") } sleep 5 wait_until_client_ready wait_until_logs_uploaded say("Go to your Dashboard! #{Flydata::FLYDATA_API_HOST}") say < 0 end def uploaded_successfully?(data_port_id) res = flydata.get("/data_ports/#{data_port_id}/tail.json") res and res['logs'] and res['logs'].size > 0 end end end end