Class: CLISplash::CLIController
- Inherits:
-
Thor
- Object
- Thor
- CLISplash::CLIController
- Defined in:
- lib/splash/cli/daemon.rb
Overview
Thor inherited class for splashd daemon management
Constant Summary
Constants included from Splash::Loggers
Splash::Loggers::ALIAS, Splash::Loggers::LEVELS
Constants included from Splash::Constants
Splash::Constants::AUTHOR, Splash::Constants::BACKENDS_STRUCT, Splash::Constants::CONFIG_FILE, Splash::Constants::COPYRIGHT, Splash::Constants::DAEMON_LOGMON_SCHEDULING, Splash::Constants::DAEMON_METRICS_SCHEDULING, Splash::Constants::DAEMON_PID_FILE, Splash::Constants::DAEMON_PROCESS_NAME, Splash::Constants::DAEMON_PROCMON_SCHEDULING, Splash::Constants::DAEMON_STDERR_TRACE, Splash::Constants::DAEMON_STDOUT_TRACE, Splash::Constants::DEFAULT_RETENTION, Splash::Constants::EMAIL, Splash::Constants::EXECUTION_TEMPLATE, Splash::Constants::EXECUTION_TEMPLATE_TOKENS_LIST, Splash::Constants::LICENSE, Splash::Constants::LOGGERS_STRUCT, Splash::Constants::PID_PATH, Splash::Constants::PROMETHEUS_ALERTMANAGER_URL, Splash::Constants::PROMETHEUS_PUSHGATEWAY_URL, Splash::Constants::PROMETHEUS_URL, Splash::Constants::TRACE_PATH, Splash::Constants::TRANSPORTS_STRUCT, Splash::Constants::VERSION, Splash::Constants::WEBADMIN_IP, Splash::Constants::WEBADMIN_PID_FILE, Splash::Constants::WEBADMIN_PID_PATH, Splash::Constants::WEBADMIN_PORT, Splash::Constants::WEBADMIN_PROCESS_NAME, Splash::Constants::WEBADMIN_PROXY, Splash::Constants::WEBADMIN_STDERR_TRACE, Splash::Constants::WEBADMIN_STDOUT_TRACE
Constants included from Splash::Exiter
Instance Method Summary collapse
- #getjobs(hostname = Socket.gethostname) ⇒ Object
- #ping(hostname = Socket.gethostname) ⇒ Object
- #purge ⇒ Object
- #reset(hostname = Socket.gethostname) ⇒ Object
- #start ⇒ Object
- #status ⇒ Object
- #stop ⇒ Object
Methods included from Splash::Loggers
#change_logger, #get_logger, #get_session
Methods included from Splash::Config
Methods included from Splash::ConfigUtilities
#addservice, #checkconfig, #flush_backend, #setupsplash
Methods included from Splash::Helpers
#check_unicode_term, #daemonize, #format_by_extensions, #format_response, #get_processes, #group_root, #install_file, #is_root?, #make_folder, #make_link, #run_as_root, #search_file_in_gem, #user_root, #verify_file, #verify_folder, #verify_link, #verify_service
Methods included from Splash::Exiter
Methods included from Splash::Transports
#get_default_client, #get_default_subscriber
Methods included from Splash::Daemon::Controller
#startdaemon, #statusdaemon, #stopdaemon
Instance Method Details
#getjobs(hostname = Socket.gethostname) ⇒ Object
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/splash/cli/daemon.rb', line 83 def getjobs(hostname=Socket.gethostname) log = get_logger log.info "ctrl+c for interrupt" begin transport = get_default_client if transport.class == Hash and transport.include? :case then splash_exit transport else log.receive transport.execute({ :verb => :get_jobs, :return_to => "splash.#{Socket.gethostname}.returncli", :queue => "splash.#{hostname}.input" }) splash_exit case: :quiet_exit end rescue Interrupt splash_exit status: :error, case: :interrupt, more: "getjobs Command" end end |
#ping(hostname = Socket.gethostname) ⇒ Object
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/splash/cli/daemon.rb', line 62 def ping(hostname=Socket.gethostname) log = get_logger log.info "ctrl+c for interrupt" begin transport = get_default_client if transport.class == Hash and transport.include? :case then splash_exit transport else log.receive transport.execute({ :verb => :ping, :payload => {:hostname => Socket.gethostname}, :return_to => "splash.#{Socket.gethostname}.returncli", :queue => "splash.#{hostname}.input" }) splash_exit case: :quiet_exit end rescue Interrupt splash_exit status: :error, case: :interrupt, more: "ping Command" end end |
#purge ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/splash/cli/daemon.rb', line 32 def purge log = get_logger log.level = :fatal if [:quiet] transport = get_default_client if transport.class == Hash and transport.include? :case then splash_exit transport else queue = "splash.#{Socket.gethostname}.input" transport.purge queue: queue log.ok "Queue : #{queue} purged" splash_exit case: :quiet_exit end end |
#reset(hostname = Socket.gethostname) ⇒ Object
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 |
# File 'lib/splash/cli/daemon.rb', line 103 def reset(hostname=Socket.gethostname) log = get_logger log.info "ctrl+c for interrupt" begin transport = get_default_client if transport.class == Hash and transport.include? :case then splash_exit transport else log.receive transport.execute({ :verb => :reset, :return_to => "splash.#{Socket.gethostname}.returncli", :queue => "splash.#{hostname}.input" }) splash_exit case: :quiet_exit end rescue Interrupt splash_exit status: :error, case: :interrupt, more: "reset Command" end end |
#start ⇒ Object
25 26 27 28 |
# File 'lib/splash/cli/daemon.rb', line 25 def start acase = run_as_root :startdaemon, splash_exit acase end |
#status ⇒ Object
55 56 57 58 |
# File 'lib/splash/cli/daemon.rb', line 55 def status acase = run_as_root :statusdaemon splash_exit acase end |
#stop ⇒ Object
48 49 50 51 |
# File 'lib/splash/cli/daemon.rb', line 48 def stop acase = run_as_root :stopdaemon splash_exit acase end |