Class: Flydata::Command::Sender
- Inherits:
-
Base
- Object
- Base
- Flydata::Command::Sender
show all
- Defined in:
- lib/flydata/command/sender.rb
Constant Summary
collapse
- FLYDATA_HOME =
Flydata::HOME_DIR
Instance Method Summary
collapse
Methods inherited from Base
#ask_input_table_name, #ask_yes_no, #choose_one, #flydata, #initialize, #newline, #register_crontab, #retrieve_data_entries, #separator
Instance Method Details
#kill_all ⇒ Object
57
58
59
60
61
62
63
64
|
# File 'lib/flydata/command/sender.rb', line 57
def kill_all
if system("ps ax | grep 'flydata' | grep -v grep | awk '{print \"kill \" $1}' | sh")
say("Done.")
return true
else
raise 'Something has gone wrong...'
end
end
|
#restart ⇒ Object
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
# File 'lib/flydata/command/sender.rb', line 43
def restart
if process_exist?
say('Restarting sender process.')
if system("kill -HUP `cat #{FLYDATA_HOME}/flydata.pid`")
say('Done.')
return true
else
raise 'Something has gone wrong..'
end
else
say("Process doesn't exist.")
start
end
end
|
#start ⇒ Object
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
# File 'lib/flydata/command/sender.rb', line 5
def start
if process_exist?
say("Process is still running. Please stop process first.")
return
end
wait_until_server_ready
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
data_port = flydata.data_port.get
say("Go to your Dashboard! #{flydata.flydata_api_host}/data_ports/#{data_port['id']}")
say <<EOF
Please Note: Records and Total Size are updated every 10 minutes. You can download logs one hour after they are generated as they are sent to s3 once per hour.
EOF
end
|
#stop ⇒ Object
30
31
32
33
34
35
36
37
38
39
40
41
42
|
# File 'lib/flydata/command/sender.rb', line 30
def stop
unless process_exist?
say("Process doesn't exist.")
return true
end
say('Stopping sender process.')
if system("kill `cat #{FLYDATA_HOME}/flydata.pid`") and wait_until_client_stop
say('Done.')
return true
end
raise 'Something has gone wrong..'
end
|