Class: Flydata::Command::Helper
- Inherits:
-
Base
- Object
- Base
- Flydata::Command::Helper
show all
- Defined in:
- lib/flydata/command/helper.rb
Constant Summary
collapse
- DEFAULT_OPTIONS =
{
daemonize: false,
supervisor: true,
workers: 2,
log: nil,
log_level: 'info',
log_rotate_age: 10,
log_rotate_size: 10*1024*1024
}
Instance Attribute Summary
Attributes inherited from Base
#opts
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
#ask_input_table_name, #ask_yes_no, #choose_one, #data_entry, #flydata, #newline, #register_crontab, #retrieve_data_entries, #separator, #show_purpose_name
#before_logging, #log_error_stderr, #log_info_stdout, #log_warn_stderr
Constructor Details
#initialize(options = Slop.new) ⇒ Helper
Returns a new instance of Helper.
35
36
37
38
39
|
# File 'lib/flydata/command/helper.rb', line 35
def initialize(options = Slop.new)
super
@helper_config = Flydata::Helper::ConfigParser.parse_file(opts[:config])[:helper]
create_helper_dirs
end
|
Class Method Details
.slop_start ⇒ Object
23
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/flydata/command/helper.rb', line 23
def self.slop_start
Slop.new do
on 'c=', 'config=','config file path'
on 'n', 'no-daemon', 'Start Helper as a regular program'
on 'l=', 'log=', 'log file path'
on 'e=', 'level=', 'log level'
on 'r=', 'rotate=', 'Number of times logs are rotated before being removed'
on 's=', 'size=', 'Size (in bytes) after which log is rotated'
end
end
|
Instance Method Details
#restart ⇒ Object
66
67
68
69
70
71
72
73
|
# File 'lib/flydata/command/helper.rb', line 66
def restart
if running?
log_info_stdout("Restarting Helper.")
run_command(kill_hup_cmd)
else
raw_start
end
end
|
#start ⇒ Object
41
42
43
44
45
46
47
|
# File 'lib/flydata/command/helper.rb', line 41
def start
if running?
log_info_stdout("Helper is already running.")
else
raw_start
end
end
|
#status ⇒ Object
58
59
60
61
62
63
64
|
# File 'lib/flydata/command/helper.rb', line 58
def status
if running?
log_info_stdout("Helper is running.")
else
log_info_stdout("Helper is not running.")
end
end
|
#stop ⇒ Object
49
50
51
52
53
54
55
56
|
# File 'lib/flydata/command/helper.rb', line 49
def stop
if running?
log_info_stdout("Stopping Helper.")
run_command(stop_cmd)
else
log_info_stdout("Helper is not running.")
end
end
|