class Systemd::SystemdManager
Main class to interact with systemd
Public Class Methods
new()
click to toggle source
# File lib/systemd/systemd_manager.rb, line 6 def initialize dbus = DBus::SystemBus.instance systemd_service = dbus.service('org.freedesktop.systemd1') @systemd_object = systemd_service.object('/org/freedesktop/systemd1') @systemd_object.introspect @units = {} refresh_units end
Public Instance Methods
get_unit(unit_name)
click to toggle source
# File lib/systemd/systemd_manager.rb, line 19 def get_unit(unit_name) @units[unit_name] end
refresh_units()
click to toggle source
# File lib/systemd/systemd_manager.rb, line 23 def refresh_units @units.clear unit_list = @systemd_object.ListUnits() unit_list.first.each do |unit| current_unit = Systemd::Unit::ServiceUnit.new(unit) @units[current_unit.name] = current_unit end end
units()
click to toggle source
# File lib/systemd/systemd_manager.rb, line 15 def units @units.values end