examples/jexec.rb
author Mahlon E. Smith <mahlon@martini.nu>
Tue, 03 Mar 2009 22:23:45 +0000
changeset 7 4460fc10c6a3
parent 0 92d00ff32c56
permissions -rw-r--r--
* Now with 87% more hot jail action! * Predeclared all C methods in jail.h, so they could be arranged in logical order in jail.c * Fixed the extconf namespace. * Added rdoc. * Added usage examples, demonstrating jls, jexec, and jail ruby equivalents. * Re-added the "attach and execute within a block" code. * Added Enumerable and Comparable support. * Return 'path' as a Pathname object. TODO: * Create the actual 'jParallel' shell binary, now that we have a good backend framework. * Tests? How? * Add support for recently committed (will be part of 7.2-RELEASE) multiple IPs per jail, and jail labels.

#!/usr/bin/env ruby
#
# An example 'jexec' in ruby.
#

BEGIN {
	require 'pathname'
	basedir = Pathname.new( __FILE__ ).dirname.parent

	$LOAD_PATH.unshift basedir + "ext" unless 
		$LOAD_PATH.include? basedir + "ext"
}

require 'jail'

BSD::Jail.attach( ARGV.shift.to_i )
exec( *ARGV )