NAME
Supervisor::Process - Defines a managed process for the Supervisor environment
SYNOPSIS
A managed process is defined and started as follows:
my $process = Supervisor::Process->new(
Name => 'sleeper',
Command => 'sleeper.sh',
Umask => '0022',
User => 'kesteb',
Group => 'users',
Directory => '/',
Priority => 0,
StartWaitSecs => 10,
StartRetries => 5,
StopSignal => 'TERM',
StopWaitSecs => 10,
StopRetries => 5,
ReloadSignal => 'HUP',
Autostart => TRUE,
AutoRestart => TRUE,
Supervisor => 'Controller',
Logfile => '/dev/stdout',
ExitCodes => '0,1',
Environment => 'item=value;;item2=value2'
);
$process->start();
DESCRIPTION
A managed process is an object that knows how to start/stop/reload and return the status of that process. How the object knows what to do, is defined by the parameters that are set when the object is created. Those parameters are as follows.
PARAMETERS
- Name
-
The name the process is know by. A string value.
Example: Name => 'test'
- Command
-
The command to run within the process. A string value.
Example: Command => '/home/kesteb/test.sh it works'
- User
-
The user context the run the process under. No effort is made to check if the user actually exists. A string value.
Example: User => 'kesteb'
- Group
-
The group context to run the process under. No effort is made to check if the group actually exists. A string value.
Example: Group => 'users'
- Umask
-
The umask for this process. A string value.
Example: Umask => "0022"
- Directory
-
The directory to set default too when running the process. No effort is made to make sure the directory is valid. A string value.
Example: Directory => "/"
- Priority
-
The priority to run the process at. An integer value.
Example: Priority => 0
- StartRetries
-
The number of retires when trying to start the process. An integer value.
Example: StartRetries => 5
- StartWaitSecs
-
The number of seconds to wait between attempts to start the process. An integer value.
Example: StartWaitSecs => 5
- StopSignal
-
The signal to send when trying to stop the process. A string value. It should be in a format that Perl understands.
Example: StopSignal => 'TERM'
- StopRetries
-
How many times to try and stop the process before issuing a KILL signal. An integer value.
Example: StopRetries => 5
- StopWaitSecs
-
The number of seconds to wait between attempts to stop the process. A intger value.
Example: StopWaitSecs => 10
- ReloadSignal
-
The signal to use to attempt a "reload" on the process. A string value. It should in a format that Perl understands.
Example: ReloadSignal => 'HUP'
- AutoStart
-
Wither the process should be auto started by a supervisor. A boolean value.
Example: AutoStart => 1 (true) AutoStart => 0 (false)
- AutoRestart
-
Wither to attempt to restart the process should it unexpectedly exit. A boolean value.
Example: AutoRestart => 1 (true) AutoRestart => 0 (false)
- Supervisor
-
The session name of a controlling supervisor. A string value.
Example: Supervisor => 'Controller'
- Logfile
-
The name of the log file to send output from stdout and stderr. A string value.
Example: Logfile => '/var/log/mylog.log' Logfile => '/dev/stdout'
- ExitCodes
-
The expected exit codes from the process. If a returned exit code does not match this list, the process will not be restarted. This should be a comma delimited list of integers.
Example: ExitCodes => 0,1
- Environment
-
The environment variables for the process. This needs to be a formated string.
Example: Environment => 'item=value;;item2=value2'
METHODS
- start
-
This method will start the process running. Will return "start" if successful.
- stop
-
This method will stop the process. Will return "stop" if successful.
- stat
-
This method will perform a "stat" on the process. It will return either "alive" or "dead".
- reload
-
This method will send a signal to the process to "reload".
- killme
-
This method will send a KILL signal to the process.
SEE ALSO
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.