Sha256: b1029c90be20fb3a038178646eaad1795ad9f94cebe12ea1784635fe9a34a212

Contents?: true

Size: 1.07 KB

Versions: 14

Compression:

Stored size: 1.07 KB

Contents

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

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

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

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

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

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

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

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

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

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
specinfra-2.30.3 lib/specinfra/command/module/systemd.rb
specinfra-2.30.2 lib/specinfra/command/module/systemd.rb
specinfra-2.30.1 lib/specinfra/command/module/systemd.rb
specinfra-2.30.0 lib/specinfra/command/module/systemd.rb
specinfra-2.29.0 lib/specinfra/command/module/systemd.rb
specinfra-2.28.4 lib/specinfra/command/module/systemd.rb
specinfra-2.28.3 lib/specinfra/command/module/systemd.rb
specinfra-2.28.2 lib/specinfra/command/module/systemd.rb
specinfra-2.28.1 lib/specinfra/command/module/systemd.rb
specinfra-2.28.0 lib/specinfra/command/module/systemd.rb
specinfra-2.27.1 lib/specinfra/command/module/systemd.rb
specinfra-2.27.0 lib/specinfra/command/module/systemd.rb
specinfra-2.26.1 lib/specinfra/command/module/systemd.rb
specinfra-2.26.0 lib/specinfra/command/module/systemd.rb