class Bitcoin2Graphdb::CLI

Public Instance Methods

restart() click to toggle source
# File lib/bitcoin2graphdb/cli.rb, line 45
def restart()
  conf = read_conf options[:conf]
  execute_daemon(options[:log], options[:pid], ['restart', conf])
end
start() click to toggle source
# File lib/bitcoin2graphdb/cli.rb, line 28
def start()
  conf = read_conf options[:conf]
  execute_daemon(options[:log], options[:pid], ['start', conf])
end
status() click to toggle source
# File lib/bitcoin2graphdb/cli.rb, line 39
def status
  execute_daemon(options[:log], options[:pid], ['status'])
end
stop() click to toggle source
# File lib/bitcoin2graphdb/cli.rb, line 34
def stop
  execute_daemon(options[:log], options[:pid], ['stop'])
end

Private Instance Methods

execute_daemon(log, pid, cmd_args) click to toggle source
# File lib/bitcoin2graphdb/cli.rb, line 59
def execute_daemon(log, pid, cmd_args)
  Bitcoin2Graphdb::Bitcoin2GraphdbDaemon.spawn!(
    { working_dir: Dir.pwd,
      log_file: File.expand_path(log),
      pid_file: File.expand_path(pid),
      sync_log: true,
      singleton: true},
    cmd_args)
end
read_conf(conf_path) click to toggle source
# File lib/bitcoin2graphdb/cli.rb, line 51
def read_conf(conf_path)
  unless File.exists?(conf_path)
    raise ArgumentError.new(
            "configuration file[#{options[:conf]}] not specified or does not exist.")
  end
  YAML.load( File.read(options[:conf]) ).deep_symbolize_keys
end