Sha256: 873e4c25dc2102a327068bba18137f23f666aaf3cc1d655b2edd93a18ba54a29

Contents?: true

Size: 1.3 KB

Versions: 21

Compression:

Stored size: 1.3 KB

Contents

module Specinfra
  module Command
    module Module
      module Service
        module Systemd
          def check_is_enabled_under_systemd(service, level="multi-user.target")
            if level.to_s =~ /^\d+$/
              level = "runlevel#{level}.target"
            end
            unless service.match(/\.(service|mount|device|socket)$/)
              service += '.service'
            end

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

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

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

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

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

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

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

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

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
specinfra-2.36.8 lib/specinfra/command/module/service/systemd.rb
specinfra-2.36.7 lib/specinfra/command/module/service/systemd.rb
specinfra-2.36.6 lib/specinfra/command/module/service/systemd.rb
specinfra-2.36.5 lib/specinfra/command/module/service/systemd.rb
specinfra-2.36.4 lib/specinfra/command/module/service/systemd.rb
specinfra-2.36.3 lib/specinfra/command/module/service/systemd.rb
specinfra-2.36.2 lib/specinfra/command/module/service/systemd.rb
specinfra-2.36.1 lib/specinfra/command/module/service/systemd.rb
specinfra-2.36.0 lib/specinfra/command/module/service/systemd.rb
specinfra-2.35.1 lib/specinfra/command/module/service/systemd.rb
specinfra-2.35.0 lib/specinfra/command/module/service/systemd.rb
specinfra-2.34.9 lib/specinfra/command/module/service/systemd.rb
specinfra-2.34.8 lib/specinfra/command/module/service/systemd.rb
specinfra-2.34.7 lib/specinfra/command/module/service/systemd.rb
specinfra-2.34.6 lib/specinfra/command/module/service/systemd.rb
specinfra-2.34.5 lib/specinfra/command/module/service/systemd.rb
specinfra-2.34.4 lib/specinfra/command/module/service/systemd.rb
specinfra-2.34.3 lib/specinfra/command/module/service/systemd.rb
specinfra-2.34.2 lib/specinfra/command/module/service/systemd.rb
specinfra-2.34.1 lib/specinfra/command/module/service/systemd.rb