add who example
This commit is contained in:
parent
f51655e4e3
commit
c4e5638fdd
|
@ -0,0 +1,13 @@
|
|||
require 'rbsigar'
|
||||
|
||||
def format_time(who)
|
||||
return Time.at(who.time).strftime("%b %e %H:%M")
|
||||
end
|
||||
|
||||
sigar = Sigar.new
|
||||
|
||||
whos = sigar.who_list
|
||||
|
||||
whos.each do |who|
|
||||
puts who.user + "\t" + who.device + "\t" + format_time(who) + who.host
|
||||
end
|
Loading…
Reference in New Issue