NAME

XAS::Supervisor::Factory - factory method to load processes

SYNOPSIS

This module is used to create multiple processes from a configuration file.

my $ctx;
my @processes = XAS::Supervisor::Factory->load(
   -cfgfile    => 'supervisor.ini',
   -supervisor => 'supervisor',
);

foreach my $process (@processes) {

    $process->startme($ctx);

}

DESCRIPTION

This module will take a configuration file and initilize all the managed processes defined within. The configuration follows the familiar Win32 .ini format. It is based, partially, on the configuration file used by the Supervisord project. Here is an example:

; My configuration file
;
[program:test]
command = /home/kesteb/outside/Supervisor/trunk/bin/test.sh
user = kesteb

This is the minimum of items needed to define a managed process. There are many more available. So what does this minimum show:

    o Item names are case sensitve.

    o A ";" indicates the start of a comment.

    o The section header must be unique and start with "program:".

    o It defines the command to be ran.

    o It defines a name that will be used to control the process.

    o It defines the user context that the command will be ran under.

These configuration items have corresponding parameters in XAS::Supervisor::Process.

ITEMS

command

This specifies the command to be ran. This must be supplied. It is directly related to the -command parameter.

user

This specifies the user context this command will run under. This must be supplied. It is directly related to the -user parameter.

directory

The directory to set as the default before running the command. Defaults to "/". It is directly related to the -directory parameter.

environment

The environment variables that are set before running the command. Defaults to the environment varaibles within the main supervisor's processes context. It is directly related to the -environment parameter.

umask

The umask of the command that is being ran. It defaults to "0022". It is directly related to the -umask parameter.

exit-codes

The expected exit codes from the process. It defaults to "0,1" and is an array. If the processes exit code doesn't match these values. The process will not be re-started. It is directly related to the -exit_codes parameter.

priority

The priority that the process will be ran under. It defaults to "0". It is directly related to the -priotity parameter.

auto-start

Indicates wither the process should be started when the supervisor starts up. Defaults to "1" for true, and where "0" is false. It is directly related to the -auto_start parameter.

auto-restart

Indicates wither to automatically restart the process when it exits. Defaults to "1" for true and where "0" is false. It is directly related to the -auto_restart parameter.

stop-signal

Indicates which signal to use to stop the process. Defaults to "TERM". It is directly related to the -stop_signal parameter.

stop-retries

Indicates how many times the supervisor should try to stop the process before sending it a KILL signal. Defaults to "5". I tis directly related to the -stop_retries parameter.

stop-wait-secs

Indicates how many seconds to wait between attempts to stop the process. Defaults to "10". It is directly related to the -stop_wait_secs parameter.

start-retries

Indicates how many start attempts should be done on process. Defaults to "5". It is directly realted to the -start_retries parameter.

start-wait-secs

Indicates how many seconds to wait between attempts to start the process. Defaults to "10". If is directly related to the -start_wait_secs parameter.

reload-signal

Indicates the signal to use to send a "reload" signal to the process. Defaults to "HUP". It is directly related to the -reload_signal parameter.

SEE ALSO

XAS

AUTHOR

Kevin L. Esteb, <kevin@kesteb.us>

COPYRIGHT AND LICENSE

Copyright (C) 2013 by Kevin L. Esteb

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.