Sha256: 83d4b4951d01907a335fe9bf972a9493a00739c99ea5b7a5f3553a9c4e62f6ab

Contents?: true

Size: 843 Bytes

Versions: 8

Compression:

Stored size: 843 Bytes

Contents

module Specinfra::Command::Module::Systemd
  def check_is_enabled(service, level="multi-user.target")
    if level.to_s =~ /^\d+$/
      level = "runlevel#{level}.target"
    end

    "systemctl --plain list-dependencies #{level} | grep '^#{escape(service)}.service$'"
  end

  def check_is_running(service)
    "systemctl is-active #{escape(service)}.service"
  end

  def enable(service)
    "systemctl enable #{escape(service)}.service"
  end

  def disable(service)
    "systemctl disable #{escape(service)}.service"
  end

  def start(service)
    "systemctl start #{escape(service)}.service"
  end

  def stop(service)
    "systemctl stop #{escape(service)}.service"
  end

  def restart(service)
    "systemctl restart #{escape(service)}.service"
  end

  def reload(service)
    "systemctl reload #{escape(service)}.service"
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
specinfra-2.0.0.beta43 lib/specinfra/command/module/systemd.rb
specinfra-2.0.0.beta42 lib/specinfra/command/module/systemd.rb
specinfra-2.0.0.beta41 lib/specinfra/command/module/systemd.rb
specinfra-2.0.0.beta40 lib/specinfra/command/module/systemd.rb
specinfra-2.0.0.beta39 lib/specinfra/command/module/systemd.rb
specinfra-2.0.0.beta38 lib/specinfra/command/module/systemd.rb
specinfra-2.0.0.beta37 lib/specinfra/command/module/systemd.rb
specinfra-2.0.0.beta36 lib/specinfra/command/module/systemd.rb