The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

XAS::Apps::Supervisor::Monitor - A class for the XAS environment

SYNOPSIS

 use XAS::Apps::Supervisor::Monitor;

 my $app = XAS::Apps::Supervisor::Montior->new(
     -throws = 'xas-supervisor',
 );

 exit $app->run;

DESCRIPTION

This module will spawn multiple processes. It will keep track of them and restart them if they should stop.

CONFIGURATION

The configuration file is the familiar Windows .ini format. It has the following stanzas.

 [supervisor: xas-logmon]
 auto-start = 1
 auto-restart = 1
 command = xas-logmon 
 directory = /
 environment = name1=value1;;name2=value2
 exit-codes = 0,1
 exit-retires = 5
 group = xas
 priority = 0
 umask = 0022
 user = xas
 redirect = 0

This stanza defines a process to manage. There can be multiple stanzas. The "xas-logmon" in the stanza name must be unique and is associated with the process. This name is used to control this process. Reasonable defaults have been defined. You really only need to use 'command' to start a process.

The following properties may be used.

auto-start

This indicates that the process should auto start. Defaults to 1.

auto-restart

This indicates wither the process should auto restart the process should it exit. This would match the exit code to the exit-code parameter. If they match, then the process would be restarted. Defaults to 1.

directory

The default directory to set for the process. Defaults to "/".

environment

Optional additional environment variables to pass to the process. This should be in this form "key1=value1;;key2=value2".

exit-codes

The possible exit codes that might be returned if the process aborts. These are used to determine if the process should be restarted. Defaults to "0,1". This must be a comma delimited list of values.

exit-retires

The number of retries for restarting the process. Defaults to "5". If this is "-1" then retries are unlimited. Use with caution.

group

The group to run the process under. Defaults to "xas". Not implemented under Windows.

priority

The priority to run the process under. Defaults to "0". Not implemented under Windows.

redirect

This indicates that stdout and stderr are to be redirected to the supervisor. Any output from those streams are logged to the supervisors log file. Defaults to 0.

umask

The umask to use for the process. Defaults to "0022". Not implemented under Windows.

user

The user to run the process under. Defaults to "xas". Not implemented under Windows.

Please see XAS::Lib::Process for more details.

METHODS

setup

This method will process the config file and spawn log processes.

main

This method will start the processing.

options

These are the additional options.

--port

This defines the port to list on. Defaults to RPC_DEFAULT_PORT.

--address

This defines the address to bind too. Defaults to RPC_DEFAULT_ADDRESS.

SEE ALSO

XAS::Supervisor::Controller
XAS::Supervisor::Monitor
XAS::Supervisor
XAS

AUTHOR

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

COPYRIGHT AND LICENSE

Copyright (c) 2012-2015 Kevin L. Esteb

This is free software; you can redistribute it and/or modify it under the terms of the Artistic License 2.0. For details, see the full text of the license at http://www.perlfoundation.org/artistic_license_2_0.