Sha256: b404d8137dedff41a49d7b7ffd9d573dd6aed36e7c301e71e54e663932a76592

Contents?: true

Size: 1.22 KB

Versions: 10

Compression:

Stored size: 1.22 KB

Contents

require "thor"
require 'sqlite3'
require "dns_one"
require "dns_one/setup"

class DnsOne::CLI < Thor  

    default_task :run_srv

    # RUN

    desc "run", "run server"
    option :conf
    option :log
    option :work_dir
    def run_srv
        DnsOne::DnsOne.new(
            conf_file: options[:conf], 
            log_file: options[:log], 
            work_dir: options[:work_dir]
        ).start 
    end

    # INSTALL

    desc "install", "install dns_one"
    def install
        DnsOne::Setup.new.install
    end

    desc "uninstall", "uninstall dns_one"
    def uninstall
        DnsOne::Setup.new.uninstall
    end

    # MANAGE

    desc "start", "start dns_one"
    def start
        DnsOne::Util.ensure_sytemd
        DnsOne::Util.run "systemctl start #{DnsOne::Setup::SERVICE_NAME}"
    end

    desc "stop", "stop dns_one"
    def stop
        DnsOne::Util.ensure_sytemd
        DnsOne::Util.run "systemctl stop #{DnsOne::Setup::SERVICE_NAME}"
    end

    desc "status", "check dns_one status"
    def status
        DnsOne::Util.ensure_sytemd
        DnsOne::Util.run "systemctl status #{DnsOne::Setup::SERVICE_NAME}"
    end

    # STATS

    desc "stats", "show counters"
    def stats
        DnsOne::Stat.print
    end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
dns_one-0.4.41 lib/dns_one/cli.rb
dns_one-0.4.40 lib/dns_one/cli.rb
dns_one-0.4.39 lib/dns_one/cli.rb
dns_one-0.4.37 lib/dns_one/cli.rb
dns_one-0.4.36 lib/dns_one/cli.rb
dns_one-0.4.35 lib/dns_one/cli.rb
dns_one-0.4.34 lib/dns_one/cli.rb
dns_one-0.4.33 lib/dns_one/cli.rb
dns_one-0.4.32 lib/dns_one/cli.rb
dns_one-0.4.31 lib/dns_one/cli.rb