Download the PHP package geoffroy-aubry/supervisor without Composer

On this page you can find all versions of the php package geoffroy-aubry/supervisor. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package supervisor

Supervisor

Latest stable version Build Status  Estimated code coverage: 87% (553 of 638 lines).

Oversee script execution, recording stdout, stderr and exit code with timestamping, and ensure email notifications will be sent (on startup, success, warning or error)… plus many other features.

Technologies : Supervisor is in Bash, only unit tests are in PHP.

Supported OS : Debian/Ubuntu Linux, FreeBSD/OS X.

Table of Contents

Features

General

Notifications

Ergonomics

Code quality

Requirements

Tested on Debian/Ubuntu Linux and FreeBSD/OS X.

Usage

Help on command prompt

Displayed by:

Text version
Description
    Oversee script execution, recording stdout, stderr and exit code with timestamping,
    and ensure email notifications will be sent (on start, success, warning or error).

Usage
    supervisor [OPTION]… <script-path> [<script-parameters>]
    supervisor [-c <conf-file>] --archive=<min-days>
    supervisor [-c <conf-file>] --monitor
    supervisor [-c <conf-file>] --summarize

Options
    --archive=<min-days>
        Archive in Gzip supervisor's logs older than <min-days>.

    -c <conf-file>, --conf=<conf-file>
        Specify a configuration file to load in addition to the default one,
        namely '/conf/supervisor-dist.sh'.

    --customized-mails=<file>
        Path to a Bash script customizing sent mails by redefining some of
        the sendMailOn[Init|Success|Warning|Error]() functions.
        See --param option.

    --exec-id=<string>
        Allow to force execution id, used in mails and name of logs.
        By default: YYYYMMDDHHIISS_XXXXX, where X are random digits.

    --extra-param-mode=[only-value|with-name|none]
        Two extra parameters are added to the end of <script-parameters>: a unique
        execution ID and name of file recording script's stderr. with-name mode prefixes
        values with '--exec-id=' and '--error-log-file=' respectively.
        By default: only-value.

    -h, --help
        Display this help.

    --mail-instigator=<email>
        Specify who executed the supervisor.

    --mail-to=<email>
        Add a new recipient's email address. Multiple --mail-to options may be used.

    --monitor
        Check whether supervisor's error log file is empty. If not, then send critical
        email notifications using an exponential backoff algorithm in minute increments.
        Typically called every minute with a cron job:
            * * * * * <user> /path/to/supervisor.sh --conf=<conf-file> --monitor

    -p <key>=<value>, --param=<key>=<value>
        Allow to inject multiple external parameters into customized emails.
        Assign the value <value> to the Bash variable $EXT_<key>.
        See --customized-mails option.

    --summarize=<max-nb-days>
        Display a summary of supervisor's activity during last <max-nb-days> days,
        including final status per day and per supervised script.
        Also send this summary by email.

    <script-path>
        Executable script to oversee.

    <script-parameters>
        Optional oversaw script's parameters.

Exit status
      0 if and only if no error
     65 Missing script name!
     66 Script '…' not found!
     67 Script '…' is not executable!
     68 Exit code changed from 0 to 68 due to errors.
     69 Another instance of '…' is still running with supervisor!
     71 Customized mails file not found: '…'
     72 Invalid Mutt command: '…'
    xxx Any code not null returned by user script

Exit status

List of exit status:

Successful execution

An execution is successful if and only if stderr is empty, exit status is 0 and there are no warnings.

A short example, here in Bash but no matter the language:

Output:

If SUPERVISOR_MAIL_SEND_ON_STARTUP is set to 1 in configuration file:

Note that Supervisor add two parameters in addition of script parameters:

If SUPERVISOR_MAIL_SEND_ON_SUCCESS is set to 1 in configuration file:

Content of supervisor.info.log.20131006223705_01765.gz attachment:

Content of bash_colored_simple.sh.20131006223705_01765.info.log.gz attachment:

Note that colors are stripped but indentation is kept.

Errors

An execution end in error status if either stderr is not empty or if exit status is different from 0.

PHP fatal error

We will oversee a PHP script throwing a fatal error:

Output:

If SUPERVISOR_MAIL_SEND_ON_ERROR is set to 1 in configuration file:

Content of supervisor.info.log.20131006223703_01618.gz attachment:

Content of php_fatal_error.php.20131006223703_01618.info.log.gz attachment:

Content of php_fatal_error.php.20131006223703_01618.error.log.gz attachment:

Other errors

Similarly, scripts provided below end with an error status.

It should be noted that when stderr is not-empty while exit status is 0, then Supervisor change exit status from 0 to 68 (see Exit status).

PHP notice

Content of tests/resources/php_notice.php:

Result in php_notice.php.[…].error.log.gz attachment:

PHP exception

Content of tests/resources/php_exception.php:

Result in php_exception.php.[…].error.log.gz attachment:

PHP stderr

Content of tests/resources/php_stderr.php:

Result in php_stderr.php.[…].error.log.gz attachment:

Exit not null

Content of tests/resources/bash_exit_not_null.sh:

Result in bash_exit_not_null.sh.[…].error.log.gz attachment:

Tags

Tags allow user scripts to send some information to supervisor.

Tags are strings between square brackets —for example: [warning]— used in output of supervised scripts. Tags must be at the beginning of a line or only preceded by tabulations —defined by SUPERVISOR_LOG_TABULATION— or spaces. A tag concerns all the line.

Warnings

If a successful executed script contains warning tags in its output, then its status will be changed from Success to Warning.

Default configuration: SUPERVISOR_WARNING_TAG='[WARNING]'.

If SUPERVISOR_MAIL_SEND_ON_WARNING is set to 1 in configuration file:

Please note that warnings are listed with 2 lines of context.

Debug traces

By default, messages preceded by a debug tag are hidden in Supervisor's output (but still present in <script>_<exec_id>.info.log). Set SUPERVISOR_SHOW_DEBUG_MSG to 1 to display them.

Default configuration:

E-mail related tags

Default configuration:

TO DOCUMENT

Locks

Sometimes there's the need to ensure that a script is only executed one time. In order to achieve this, set SUPERVISOR_LOCK_SCRIPT to 1 in your configuration file. Only available on Debian/Ubuntu Linux, otherwise leave 0.

Example of output:

Example of sent mail:

Customized mails

TO DOCUMENT

Supervisor supervised

TO DOCUMENT

Archiving

Archive in Gzip format all supervisor's logs older than <min-days>.

Monitoring

Check whether supervisor's error log file is empty. If not, then send critical email notifications using an exponential backoff algorithm in minute increments. Files supervisor.info.log and supervisor.error.log will be attached in Gzip format.

Typically called every minute with a cron job:

Mail generated through unit tests:

Summary

Display a summary of supervisor's activity during last <max-nb-days> days, including final status per day and per supervised script. Also send this summary by email to SUPERVISOR_MAIL_TO list.

Installation

  1. Move to the directory where you wish to store the source and clone the repository:

  2. You should be on stable branch. If not, switch your clone to that branch:

  3. Create your own configuration file and adapt it:

    Note: file conf/supervisor-dist.sh is always loaded. Then optional configuration file specified with option --conf is loaded (overwriting). But if no option --conf is found, then conf/supervisor.sh is loaded if exists.

  4. If you have to supervise scripts producing CSV output, then install Awk CSV parser component:

  5. You can create a symlink to supervisor.sh:

It's ready for use:

Copyrights & licensing

Licensed under the GNU Lesser General Public License v3 (LGPL version 3). See LICENSE file for details.

Change log

See CHANGELOG file for details.

Continuous integration

Build Status  Estimated code coverage: 87% (553 of 638 lines).

Require PHP >= 5.3.3 and Xdebug.

Create your own configuration file and adapt it:

Launch unit tests with PHPUnit:

On FreeBSD/OS X you must exclude tests about exclusive execution (SUPERVISOR_LOCK_SCRIPT):

Git branching model

The git branching model used for development is the one described and assisted by twgit tool: https://github.com/Twenga/twgit.


All versions of supervisor with dependencies

PHP Build Version
Package Version
Requires geoffroy-aubry/awk-csv-parser Version 1.*
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package geoffroy-aubry/supervisor contains the following files

Loading the files please wait ....