Module: Luban::Deployment::Packages::Grafana::Controller::Commands

Included in:
Luban::Deployment::Packages::Grafana::Configurator, Luban::Deployment::Packages::Grafana::Controller
Defined in:
lib/luban/deployment/packages/grafana/controller.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



7
8
9
# File 'lib/luban/deployment/packages/grafana/controller.rb', line 7

def self.included(base)
  base.define_executable 'grafana-server'
end

Instance Method Details

#process_patternObject



11
12
13
# File 'lib/luban/deployment/packages/grafana/controller.rb', line 11

def process_pattern
  @process_pattern ||= "\\-config #{control_file_path}$"
end

#shell_setupObject



15
16
17
# File 'lib/luban/deployment/packages/grafana/controller.rb', line 15

def shell_setup
  @shell_setup ||= super << "cd #{install_path}"
end

#start_commandObject



19
20
21
# File 'lib/luban/deployment/packages/grafana/controller.rb', line 19

def start_command
  @start_command ||= shell_command("#{grafana_server_executable} -pidfile #{pid_file_path} -config #{control_file_path}", output: nil) + ' &'
end

#stop_commandObject



23
24
25
# File 'lib/luban/deployment/packages/grafana/controller.rb', line 23

def stop_command
  @stop_command ||= shell_command("kill $(cat #{pid_file_path} 2>/dev/null)")
end