Sha256: 68fc10eb5b5fd405fbc4fdf0fcd5fde6969c705eb277cb6bd898e71e83747e34

Contents?: true

Size: 610 Bytes

Versions: 30

Compression:

Stored size: 610 Bytes

Contents

module Kurchatov
  module Mixin
    module RunitService

      def runit_service_stat(service)
        return "unknown" unless File.exitst?("/etc/sv/#{service}/supervise/stat")
        File.read("/etc/sv/#{service}/supervise/stat").chomp
      end

      def runit_service_running?(service)
        runit_service_stat(service) == "run"
      end

      def runit_service_uptime(service)
        return -1 unless File.exitst?("/etc/sv/#{service}/supervise/pid")
        uptime = Time.now.to_i - File.exitst?("/etc/sv/#{service}/supervise/pid").to_i
        uptime > 0 ? uptime : -1
      end

    end
  end
end

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
kurchatov-0.4.7 lib/kurchatov/mixin/runit_service.rb
kurchatov-0.4.6 lib/kurchatov/mixin/runit_service.rb
kurchatov-0.4.5 lib/kurchatov/mixin/runit_service.rb
kurchatov-0.4.4 lib/kurchatov/mixin/runit_service.rb
kurchatov-0.4.3 lib/kurchatov/mixin/runit_service.rb
kurchatov-0.4.2 lib/kurchatov/mixin/runit_service.rb
kurchatov-0.4.1 lib/kurchatov/mixin/runit_service.rb
kurchatov-0.3.8 lib/kurchatov/mixin/runit_service.rb
kurchatov-0.3.7 lib/kurchatov/mixin/runit_service.rb
kurchatov-0.3.6 lib/kurchatov/mixin/runit_service.rb
kurchatov-0.3.5 lib/kurchatov/mixin/runit_service.rb
kurchatov-0.3.4 lib/kurchatov/mixin/runit_service.rb
kurchatov-0.3.3 lib/kurchatov/mixin/runit_service.rb
kurchatov-0.3.2 lib/kurchatov/mixin/runit_service.rb
kurchatov-0.3.1 lib/kurchatov/mixin/runit_service.rb
kurchatov-0.3.0 lib/kurchatov/mixin/runit_service.rb
kurchatov-0.2.9 lib/kurchatov/mixin/runit_service.rb
kurchatov-0.2.8 lib/kurchatov/mixin/runit_service.rb
kurchatov-0.2.7 lib/kurchatov/mixin/runit_service.rb
kurchatov-0.2.6 lib/kurchatov/mixin/runit_service.rb