NAME

Supervisor::ProcessFactory - factory method to load processes

SYNOPSIS

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

 my @processes = Supervisor::ProcessFactory->load(
    Config => 'supervisor.ini'
 );

 foreach my $process (@processes) {

     $process->start();

 }

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
 name = test
 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 Supervisor::Process.

ITEMS

command

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

name

This specifies the name of the process. This must be supplied. It is directly related to the Name 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 unask 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 ExitCode 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 AutoStart 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 AutoRestart parameter.

stop-signal

Indicates which signal to use to stop the process. Defaults to "TERM". It is directly related to the StopSignal 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 StopRetries 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 StopWaitSecs parameter.

start-retries

Indicates how many start attempts should be done on process. Defaults to "5". It is directly realted to the StartRetries 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 StartWaitSecs 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 ReloadSignal parameter.

logfile

Indicates the logfile name to use for captured stderr and stdout text that the process may generate. Defaults to "/dev/stdout". It is directly related to the Logfile parameter.

SEE ALSO

 Supervisor
 Supervisor::Base
 Supervisor::Class
 Supervisor::Constants
 Supervisor::Controller
 Supervisor::Log
 Supervisor::Process
 Supervisor::ProcessFactory
 Supervisor::Session
 Supervisor::Utils
 Supervisor::RPC::Server
 Supervisor::RPC::Client

AUTHOR

Kevin L. Esteb, <kesteb@wsipc.org>

COPYRIGHT AND LICENSE

Copyright (C) 2009 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.5 or, at your option, any later version of Perl 5 you may have available.