Module: LinuxAdmin::Common
- Includes:
- Logging
- Included in:
- LinuxAdmin, Disk, Hosts, IpAddress, Mountable, Mountable::ClassMethods, NetworkInterface, Package, PhysicalVolume, PhysicalVolume, RegistrationSystem, Service, Service, System, TimeDate, VolumeGroup, VolumeGroup, Yum
- Defined in:
- lib/linux_admin/common.rb
Constant Summary collapse
- BIN_DIRS =
%w(/bin /sbin /usr/bin /usr/sbin /usr/local/bin /usr/local/sbin)
Instance Method Summary collapse
- #cmd(name) ⇒ Object
- #cmd?(name) ⇒ Boolean
- #run(cmd, options = {}) ⇒ Object
- #run!(cmd, options = {}) ⇒ Object
Instance Method Details
#cmd(name) ⇒ Object
9 10 11 |
# File 'lib/linux_admin/common.rb', line 9 def cmd(name) BIN_DIRS.collect { |dir| "#{dir}/#{name}" }.detect { |cmd| File.exist?(cmd) } end |
#cmd?(name) ⇒ Boolean
13 14 15 |
# File 'lib/linux_admin/common.rb', line 13 def cmd?(name) !cmd(name).nil? end |
#run(cmd, options = {}) ⇒ Object
17 18 19 20 |
# File 'lib/linux_admin/common.rb', line 17 def run(cmd, = {}) AwesomeSpawn.logger ||= logger AwesomeSpawn.run(cmd, ) end |
#run!(cmd, options = {}) ⇒ Object
22 23 24 25 |
# File 'lib/linux_admin/common.rb', line 22 def run!(cmd, = {}) AwesomeSpawn.logger ||= logger AwesomeSpawn.run!(cmd, ) end |