class Bixby::Provision::Service

Public Class Methods

new(*args) click to toggle source
Calls superclass method Bixby::Provision::Base::new
# File lib/bixby/provision/dsl/service.rb, line 10
def initialize(*args)
  super
  @services = if ubuntu? then
      Services::Init.new(self)
    elsif centos? or amazon? then
      Services::Init.new(self)
    end
end

Public Instance Methods

ensure(name) click to toggle source
# File lib/bixby/provision/dsl/service.rb, line 43
def ensure(name)
  if centos? or amazon? then
    logged_sudo("chkconfig --add #{name}")
  elsif ubuntu? then
    logged_sudo("update-rc.d #{name} defaults")
  end
end
reload(name, opts={}) click to toggle source
# File lib/bixby/provision/dsl/service.rb, line 35
def reload(name, opts={})
  @services.reload(name, opts)
end
restart(name, opts={}) click to toggle source
# File lib/bixby/provision/dsl/service.rb, line 31
def restart(name, opts={})
  @services.restart(name, opts)
end
running?(name) click to toggle source
# File lib/bixby/provision/dsl/service.rb, line 39
def running?(name)
  @services.running?(name)
end
start(name, opts={}) click to toggle source
# File lib/bixby/provision/dsl/service.rb, line 19
def start(name, opts={})
  if !running?(name) || opts[:force] == true then
    @services.start(name, opts)
  end
end
stop(name, opts={}) click to toggle source
# File lib/bixby/provision/dsl/service.rb, line 25
def stop(name, opts={})
  if running?(name) || opts[:force] == true then
    @services.stop(name, opts)
  end
end