Class: Specinfra::Command::Solaris::Base::Service

Inherits:
Base::Service show all
Defined in:
lib/specinfra/command/solaris/base/service.rb

Class Method Summary collapse

Methods inherited from Base::Service

check_is_monitored_by_god, check_is_monitored_by_monit, check_is_running_under_daemontools, check_is_running_under_runit, check_is_running_under_supervisor, check_is_running_under_upstart

Methods inherited from Base

create, escape

Class Method Details

.check_has_property(svc, property) ⇒ Object



11
12
13
14
15
16
17
18
# File 'lib/specinfra/command/solaris/base/service.rb', line 11

def check_has_property(svc, property)
  commands = []
  property.sort.each do |key, value|
    regexp = "^#{value}$"
    commands << "svcprop -p #{escape(key)} #{escape(svc)} | grep -- #{escape(regexp)}"
  end
  commands.join(' && ')
end

.check_is_enabled(service, level = nil) ⇒ Object



3
4
5
# File 'lib/specinfra/command/solaris/base/service.rb', line 3

def check_is_enabled(service, level=nil)
  "svcs -l #{escape(service)} 2> /dev/null | egrep '^enabled *true$'"
end

.check_is_running(service) ⇒ Object



7
8
9
# File 'lib/specinfra/command/solaris/base/service.rb', line 7

def check_is_running(service)
  "svcs -H -o state #{escape(service)} 2> /dev/null | egrep '^online$'"
end