Pedro Melo > App-SuperviseMe-0.004 > App::SuperviseMe

Download:
App-SuperviseMe-0.004.tar.gz

Dependencies

Annotate this POD

Website

View/Report Bugs
Module Version: 0.004   Source  

NAME ^

App::SuperviseMe - very simple command superviser

VERSION ^

version 0.004

SYNOPSIS ^

    my $superviser = App::SuperviseMe->new(
        cmds => [
          'plackup -p 3010 ./sites/x/app.psgi',
          'plackup -p 3011 ./sites/y/app.psgi',
          ['bash', '-c', '... bash script ...'],
        ],
    );
    $superviser->run;

DESCRIPTION ^

This module implements a multi-process supervisor.

It takes a list of commands to execute and starts each one, and then monitors their execution. If one of the program dies, the supervisor will restart it after a small 1 second pause.

You can send SIGTERM to the supervisor process to kill all childs and exit.

You can also send SIGINT (Ctrl-C on your terminal) to restart the processes. If a second SIGINT is received and no child process is currently running, the supervisor will exit. This allows you to tap Ctrl- C twice in quick succession in a terminal window to terminate the supervisor and all child processes

METHODS ^

new

    my $supervisor = App::SuperviseMe->new( cmds => [...], [debug => ...]);

Creates a supervisor instance with a list of commands to monitor.

It accepts a hash with the following options:

cmds

A list reference with the commands to execute and monitor. Each command can be a scalar, or a list reference.

progress

Print progress information if true. Disabled by default.

debug

Print debug information if true. ENV SUPERVISE_ME_DEBUG overrides this setting. Disabled by default.

new_from_options

    my $supervisor = App::SuperviseMe->new_from_options;

Reads the list of commands to start and monitor from STDIN. It strips white-space from the beggining and end of the line, and skips lines that start with a #.

Returns the superviser object.

run

    $supervisor->run;

Starts the supervisor, start all the child processes and monitors each one.

This method returns when the supervisor is stopped with either a SIGINT or a SIGTERM.

SEE ALSO ^

AnyEvent

SUPPORT ^

Perldoc

You can find documentation for this module with the perldoc command.

  perldoc App::SuperviseMe

Websites

The following websites have more information about this module, and may be of help to you. As always, in addition to those websites please use your favorite search engine to discover more resources.

Email

You can email the author of this module at MELO at cpan.org asking for help with any problems you have.

Bugs / Feature Requests

Please report any bugs or feature requests through the web interface at https://github.com/melo/App-SuperviseMe/issues. You will be automatically notified of any progress on the request by the system.

Source Code

The code is open to the world, and available for you to hack on. Please feel free to browse it and play with it, or whatever. If you want to contribute patches, please send me a diff or prod me to pull from your repository :)

https://github.com/melo/App-SuperviseMe

  git clone git://github.com/melo/App-SuperviseMe.git

AUTHOR ^

Pedro Melo <melo@simplicidade.org>

COPYRIGHT AND LICENSE ^

This software is Copyright (c) 2011 by Pedro Melo.

This is free software, licensed under:

  The Artistic License 2.0 (GPL Compatible)
syntax highlighting: