| CfgTie documentation | view source | Contained in the CfgTie distribution. |
CfgTie::TieRCService -- A module to manage Unix services
my %RC; tie %RC, 'CfgTie::TieRCService';
This is a straightforward interface to the control scripts in @file{/etc/rc?.d} This package helps manage these system services. The tie hash is structured like so:
{
$Service_Name => $Service_Ref,
}
$Service_Ref is a hash reference; the details will be covered in the next
section. (tied $Service_Ref) can also be treated as an object to control
the service. That is covered in the Service Methods section.
While fetching from the structure, and deleting services is supported (and reflected to the system), directly storing new services is not. Currently the method to do this is:
(tied %RC)->add('mynewservice');
This will add the new service (to be managed as well as available) to the run-levels. The start and kill scripts will be linked into each appropriate run-level. The script should already exist (in the proper format) in /etc/rc.d/init.d or equivalent.
{
levels => [],
defaults => [],
category => [],
pid => $pid,
path =>,
description =>,
start_priority=>,
stop_priority =>,
}
levels refers to a list used to determine if the service is present for a
given run-level.
The scope of changes this list is system-wide. It is persistent across
boots.
Example:
my $listref = (tied %{$RC{'atd'}})->levels();
if ($L < scalar @{$listref} && $listref->[$L])
{print "present at run level $L\n";}
new($service_name,$path) path is optional, and may refer either to the
folder containing the relevant control script, or may refer to the control
script itself.
start will start the service (if not already started).
The scope of this action is system-wide.
Example: $Obj->start();
stop will stop the service (if running).
The scope of this action is system-wide.
Example: $Obj->stop();
restart will restart the service, effectively stopping it (if it is
running) and then starting it.
The scope of this action is system-wide.
Example: $Obj->restart();
status
The scope of this action is limited to a single session.
reload
The scope of this action is system-wide.
This can not create a new service start/kill script. At best this can only modify an existing one, or link it into the init folders.
Requires /sbin/chkconfig to work.
Randall Maas (randym@acm.org)
| CfgTie documentation | view source | Contained in the CfgTie distribution. |