module Flydata module Command class Sender < Base FLYDATA_HOME=Flydata::HOME_DIR def start # Check if process exist if process_exist? say("Process is still running. 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 data_port = flydata.data_port.get say("Go to your Dashboard! #{flydata.flydata_api_host}/data_ports/#{data_port['id']}") 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