diff -r 2d52adc4adcc -r 4460fc10c6a3 examples/jls.rb --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/examples/jls.rb Tue Mar 03 22:23:45 2009 +0000 @@ -0,0 +1,21 @@ +#!/usr/bin/env ruby +# +# An example of the 'jls' utility in ruby. +# Output is sorted by hostname. +# + +BEGIN { + require 'pathname' + basedir = Pathname.new( __FILE__ ).dirname.parent + + $LOAD_PATH.unshift basedir + "ext" unless + $LOAD_PATH.include? basedir + "ext" +} + +require 'jail' + +puts " JID IP Address Hostname Path" +BSD::Jail.sort_by {|j| j.host }.each do |j| + puts "%6d %-15.15s %-29.29s %.74s" % [ j.jid, j.ip, j.host, j.path ] +end +