Class: Flydata::Command::Sender
- Inherits:
-
Base
- Object
- Base
- Flydata::Command::Sender
show all
- Defined in:
- lib/flydata/command/sender.rb
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
63
64
65
66
67
68
69
70
|
# File 'lib/flydata/command/sender.rb', line 63
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
# File 'lib/flydata/command/sender.rb', line 42
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
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/flydata/command/sender.rb', line 4
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 -p #{File.dirname(__FILE__)}/../fluent-plugins")
}
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-20 minutes.
EOF
end
|
#status ⇒ Object
56
57
58
59
60
61
62
|
# File 'lib/flydata/command/sender.rb', line 56
def status
if process_exist?
say("Process is running.")
else
say("Process is not running.")
end
end
|
#stop ⇒ Object
29
30
31
32
33
34
35
36
37
38
39
40
41
|
# File 'lib/flydata/command/sender.rb', line 29
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
|