Class: Specinfra::Command::Windows::Base::Service

Inherits:
Specinfra::Command::Windows::Base show all
Defined in:
lib/specinfra/command/windows/base/service.rb

Class Method Summary collapse

Methods inherited from Specinfra::Command::Windows::Base

create

Class Method Details

.check_has_start_mode(service, mode) ⇒ Object


10
11
12
13
14
15
# File 'lib/specinfra/command/windows/base/service.rb', line 10

def check_has_start_mode(service, mode)
  Backend::PowerShell::Command.new do
    using 'find_service.ps1'
    exec  "'#{mode}' -match (FindService -name '#{service}').StartMode -and (FindService -name '#{service}') -ne $null"
  end
end

.check_is_enabled(service, level = nil) ⇒ Object


17
18
19
20
21
22
# File 'lib/specinfra/command/windows/base/service.rb', line 17

def check_is_enabled(service, level=nil)
  Backend::PowerShell::Command.new do
    using 'find_service.ps1'
    exec "(FindService -name '#{service}').StartMode -eq 'Auto'"
  end
end

.check_is_installed(service) ⇒ Object


3
4
5
6
7
8
# File 'lib/specinfra/command/windows/base/service.rb', line 3

def check_is_installed(service)
  Backend::PowerShell::Command.new do
    using 'find_service.ps1'
    exec "@(FindService -name '#{service}').count -gt 0"
  end
end

.check_is_running(service) ⇒ Object


24
25
26
27
28
29
# File 'lib/specinfra/command/windows/base/service.rb', line 24

def check_is_running(service)
  Backend::PowerShell::Command.new do
    using 'find_service.ps1'
    exec "(FindService -name '#{service}').State -eq 'Running'"
  end
end