Sha256: db21003c888b166efe44727c561c040bb5e6f1d46de751ca258eade2afb0067f
Contents?: true
Size: 1.06 KB
Versions: 8
Compression:
Stored size: 1.06 KB
Contents
#!/usr/bin/env ruby require File.dirname(__FILE__) + '/../lib/kldockeragent' def version? File.read(File.dirname(__FILE__) + '/../VERSION').strip end opts = Trollop::options do version "kldockeragent #{version?} (c) 2016 Kytoonlabs" banner <<-EOS Agent for KL Docker Agent configuration management tool. Usage: kldockeragent [options] where [options] are: EOS opt :start, "Start the agent. If --daemon option is set true, then the agent will start as a daemon.", :short => '-s' opt :stop, "Stop the daemon agent.", :short => '-t' opt :restart, "Restart the daemon agent.", :short => '-r' opt :status, "Print the status of the daemon agent.", :short => '-a' end if opts[:start] if not KL::Agent.pid.nil? puts "Agent is already running with PID #{KL::Agent.pid}" else opts[:daemon] = true KL::Agent.start(opts) end elsif opts[:stop] KL::Agent.stop(opts) elsif opts[:restart] KL.logger.info '[main] Restart Agent command detected.' opts[:daemon] = true KL::Agent.stop if KL::Agent.pid.to_i > 0 KL::Agent.start(opts) elsif opts[:status] KL::Agent.status end
Version data entries
8 entries across 8 versions & 1 rubygems