Class: Skutil::Server
- Inherits:
-
Object
- Object
- Skutil::Server
- Defined in:
- lib/skutil.rb
Class Method Summary collapse
- .df ⇒ Object
- .environment ⇒ Object
- .execute(command) ⇒ Object
- .hostname ⇒ Object
- .ip_address ⇒ Object
- .netstat ⇒ Object
- .ps ⇒ Object
Class Method Details
.df ⇒ Object
133 134 135 |
# File 'lib/skutil.rb', line 133 def self.df `/bin/df -h`.chomp end |
.environment ⇒ Object
149 150 151 152 153 154 155 156 157 158 |
# File 'lib/skutil.rb', line 149 def self.environment self_methods = self.methods - Class.methods self_methods.delete("environment") self_methods.delete("execute") st = "" self_methods.each do |method| st << "#{method}:\n #{self.send(method).to_s.split("\n").join("\n ")}\n" end return st end |
.execute(command) ⇒ Object
145 146 147 |
# File 'lib/skutil.rb', line 145 def self.execute(command) `#{command}`.chomp end |
.hostname ⇒ Object
129 130 131 |
# File 'lib/skutil.rb', line 129 def self.hostname `/bin/hostname`.chomp end |
.ip_address ⇒ Object
116 117 118 119 120 121 122 123 124 125 126 127 |
# File 'lib/skutil.rb', line 116 def self.ip_address ifconfig = `/sbin/ifconfig` ips = [] # TODO mac ifconfig.gsub(/inet addr:(\d+\.\d+\.\d+\.\d+)/){|ip| if $1 != '127.0.0.1' ips << $1 end } return ips end |
.netstat ⇒ Object
141 142 143 |
# File 'lib/skutil.rb', line 141 def self.netstat `/usr/sbin/netstat -an`.chomp end |
.ps ⇒ Object
137 138 139 |
# File 'lib/skutil.rb', line 137 def self.ps `/bin/ps -ef`.chomp end |