The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

App::SuperviseMe - very simple command superviser

VERSION

version 0.001

SYNOPSIS

    my $superviser = App::SuperviseMe->new(
        cmds => [
          'plackup -p 3010 ./sites/x/app.psgi',
          'plackup -p 3011 ./sites/y/app.psgi',
        ],
    );
    $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.

METHODS

new

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

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.

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

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