Supervisor::Process - Defines a managed process for the Supervisor environment
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();
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.
The name the process is know by. A string value.
Example: Name => 'test'
The command to run within the process. A string value.
Example: Command => '/home/kesteb/test.sh it works'
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'
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'
The umask for this process. A string value.
Example: Umask => "0022"
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 => "/"
The priority to run the process at. An integer value.
Example: Priority => 0
The number of retires when trying to start the process. An integer value.
Example: StartRetries => 5
The number of seconds to wait between attempts to start the process. An integer value.
Example: StartWaitSecs => 5
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'
How many times to try and stop the process before issuing a KILL signal. An integer value.
Example: StopRetries => 5
The number of seconds to wait between attempts to stop the process. A intger value.
Example: StopWaitSecs => 10
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'
Wither the process should be auto started by a supervisor. A boolean value.
Example: AutoStart => 1 (true) AutoStart => 0 (false)
Wither to attempt to restart the process should it unexpectedly exit. A boolean value.
Example: AutoRestart => 1 (true) AutoRestart => 0 (false)
The session name of a controlling supervisor. A string value.
Example: Supervisor => 'Controller'
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'
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
The environment variables for the process. This needs to be a formated string.
Example: Environment => 'item=value;;item2=value2'
This method will start the process running. Will return "start" if successful.
This method will stop the process. Will return "stop" if successful.
This method will perform a "stat" on the process. It will return either "alive" or "dead".
This method will send a signal to the process to "reload".
This method will send a KILL signal to the process.
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
Kevin L. Esteb, <email@example.com>
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.