module Luban::Deployment::Packages::Mysql::Controller::Commands

Public Class Methods

included(base) click to toggle source
# File lib/luban/deployment/packages/mysql/controller.rb, line 7
def self.included(base)
  base.define_executable 'mysqld_safe'
  base.define_executable 'mysqladmin'
  base.define_executable 'mysqld'
end

Public Instance Methods

log_types() click to toggle source
# File lib/luban/deployment/packages/mysql/controller.rb, line 45
def log_types
  @log_types ||= %w(error general slow)
end
mysqld_safe_command() click to toggle source
# File lib/luban/deployment/packages/mysql/controller.rb, line 17
def mysqld_safe_command
  @mysqld_safe_command ||= "#{mysqld_safe_executable} --defaults-file=#{control_file_path}"
end
mysqldadmin_command() click to toggle source
# File lib/luban/deployment/packages/mysql/controller.rb, line 21
def mysqldadmin_command
  @mysqldadmin_command ||= "#{mysqladmin_executable} --defaults-file=#{admin_control_file_path}"
end
ping_command() click to toggle source
# File lib/luban/deployment/packages/mysql/controller.rb, line 37
def ping_command
  @ping_command ||= "#{mysqldadmin_command} ping"
end
process_pattern() click to toggle source
# File lib/luban/deployment/packages/mysql/controller.rb, line 25
def process_pattern
  @process_pattern ||= "^#{mysqld_executable} --defaults-file=#{control_file_path}"
end
reopen_logs_command() click to toggle source
# File lib/luban/deployment/packages/mysql/controller.rb, line 41
def reopen_logs_command
  @reopen_logs_command ||= "#{mysqldadmin_command} flush-logs #{log_types.join(' ')}"
end
shell_setup() click to toggle source
Calls superclass method
# File lib/luban/deployment/packages/mysql/controller.rb, line 13
def shell_setup
  @shell_setup ||= super << "cd #{install_path}"
end
start_command() click to toggle source
# File lib/luban/deployment/packages/mysql/controller.rb, line 29
def start_command
  @start_command ||= shell_command("#{mysqld_safe_command}", output: nil) + ' &'
end
stop_command() click to toggle source
# File lib/luban/deployment/packages/mysql/controller.rb, line 33
def stop_command
  @stop_command ||= shell_command("kill $(cat #{pid_file_path} 2>/dev/null)")
end