class AutomateIt::ServiceManager::RC_Update
ServiceManager::RC_Update¶ ↑
RC_Update
implements the enabled?
, enable
and disable
features of the ServiceManager on Gentoo-like systems.
Public Instance Methods
disable(service, opts={})
click to toggle source
See ServiceManager#disable
# File lib/automateit/service_manager/rc_update.rb, line 32 def disable(service, opts={}) _raise_unless_available return false unless enabled?(service) interpreter.sh("rc-update del #{service} default > /dev/null 2>&1") end
enable(service, opts={})
click to toggle source
See ServiceManager#enable
# File lib/automateit/service_manager/rc_update.rb, line 25 def enable(service, opts={}) _raise_unless_available return false if enabled?(service) interpreter.sh("rc-update add #{service} default > /dev/null 2>&1") end
enabled?(service)
click to toggle source
See ServiceManager#enabled?
# File lib/automateit/service_manager/rc_update.rb, line 13 def enabled?(service) _raise_unless_available # Do NOT use Gentoo's rc-update because the idiot that wrote that utility # truncates service names to look "prettier" and provides no way to disable # this annoyance for people that need to query services by name. result = %w(boot default).select do |runlevel| File.exists?(File.join("/etc/runlevels", runlevel, service)) end return ! result.empty? end