class Cfgd::Adapter::Systemd

Initsystem class for systemd based systems

Constants

SHELL_ENV
SYSTEMCTL_BIN
SYSTEMCTL_RESTART_ARGS
SYSTEMCTL_START_ARGS
SYSTEMCTL_STATUS_ARGS
SYSTEMCTL_STOP_ARGS

Public Class Methods

restart(name) click to toggle source
# File lib/adapter/initsystem/systemd.rb, line 33
def self.restart(name)
  cmd = "#{SHELL_ENV} #{SYSTEMCTL_BIN} #{SYSTEMCTL_RESTART_ARGS} #{name}"
  _stdout, _stderr, status = Open3.capture3(cmd)
  status.exitstatus.shellexit
end
start(name) click to toggle source
# File lib/adapter/initsystem/systemd.rb, line 21
def self.start(name)
  cmd = "#{SHELL_ENV} #{SYSTEMCTL_BIN} #{SYSTEMCTL_START_ARGS} #{name}"
  _stdout, _stderr, status = Open3.capture3(cmd)
  status.exitstatus.shellexit
end
status(name) click to toggle source
# File lib/adapter/initsystem/systemd.rb, line 39
def self.status(name)
  cmd = "#{SHELL_ENV} #{SYSTEMCTL_BIN} #{SYSTEMCTL_STATUS_ARGS} #{name}"
  _stdout, _stderr, status = Open3.capture3(cmd)
  status.exitstatus.shellexit
end
stop(name) click to toggle source
# File lib/adapter/initsystem/systemd.rb, line 27
def self.stop(name)
  cmd = "#{SHELL_ENV} #{SYSTEMCTL_BIN} #{SYSTEMCTL_STOP_ARGS} #{name}"
  _stdout, _stderr, status = Open3.capture3(cmd)
  status.exitstatus.shellexit
end
supports_os?(os) click to toggle source
# File lib/adapter/initsystem/systemd.rb, line 11
def self.supports_os?(os)
  true if %w[debian archlinux].include? os
end