Class: PoiseService::ServiceProviders::Systemd

Inherits:
Base
  • Object
show all
Includes:
Chef::Mixin::ShellOut
Defined in:
lib/poise_service/service_providers/systemd.rb

Overview

Since:

  • 1.0.0

Instance Method Summary collapse

Methods inherited from Base

#action_disable, #action_enable, #action_reload, #action_restart, #action_start, #action_stop, service_resource_hints

Instance Method Details

#pidObject

Since:

  • 1.0.0



45
46
47
48
49
50
51
52
# File 'lib/poise_service/service_providers/systemd.rb', line 45

def pid
  cmd = shell_out(%w{systemctl status} + [new_resource.service_name])
  if !cmd.error? && cmd.stdout.include?('Active: active (running)') && md = cmd.stdout.match(/Main PID: (\d+)/)
    md[1].to_i
  else
    nil
  end
end