diff options
-rw-r--r-- | Makefile.PL | 3 | ||||
-rw-r--r-- | lib/VServer.pm | 57 |
2 files changed, 57 insertions, 3 deletions
diff --git a/Makefile.PL b/Makefile.PL index 1b34f15..9271b36 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -3,10 +3,7 @@ use inc::Module::Install; # Define metadata -name 'VServer'; all_from 'lib/VServer.pm'; -abstract 'Little perl helpers for handling linux-vserver.'; -author 'Alexander Sulfrian <alex@spline.inf.fu-berlin.de>'; license 'perl'; resources homepage => 'http://git.spline.inf.fu-berlin.de/vserver-perl/'; diff --git a/lib/VServer.pm b/lib/VServer.pm index 8a5aa54..a5515e3 100644 --- a/lib/VServer.pm +++ b/lib/VServer.pm @@ -63,3 +63,60 @@ sub get_name($) { } 1; +__END__ + +=pod + +=head1 NAME + +VServer - little perl helpers for handling linux-vserver + +=head1 SYNOPSIS + + use VServer; + my $id = VServer::get_context_id("name"); + +=head1 DESCRIPTION + +This module contains some functions for interfacing linux-vserver +with perl. It does not use the libvserver library, but reading files +in I</proc/virtual/> and I</etc/vservers/> and executing lightwight +external tools like I<vuname>. + +=head2 Methods + +=over 4 + +=item B<get_context_id($vserver_name)> + +Returns the context id for a vserver given by its name. If an +invalid name is supplied or any other error occurs, B<undef> +is returned. + +=item B<get_proc_dir($context)> + +Build the directory in C</proc/virtual/> for the given context id. +The directory is build with the following template: +I</proc/virtual/$context/>. If the resulting directory does not exist +(e.g. because the vserver is not running), B<undef> is returned. + +=item B<get_config_dir($context)> + +Returns the config directory for the given context id. This is done +by calling C</usr/sbin/vuname>. If any error occurs, B<undef> is +returned. + +=item B<get_name($context)> + +Returns the name of the vserver specified by the given context id. +This uses B<get_config_dir($context)> and reading the name file +inside the config directory. If any error occurs, B<undef> is +returned. + +=back + +=head1 AUTHORS + +Alexander Sulfrian <alexander@sulfrian.net> + +=cut |