ControlFreak
view release on metacpan or search on metacpan
lib/ControlFreak/Service.pm view on Meta::CPAN
package ControlFreak::Service;
use strict;
use warnings;
use AnyEvent '5.202';
use AnyEvent::Util();
use AnyEvent::Handle();
use Carp;
use ControlFreak::Util();
use Data::Dumper();
use JSON::XS;
use Params::Util qw{ _NUMBER _STRING _IDENTIFIER _ARRAY _POSINT };
use POSIX qw{ SIGTERM SIGKILL };
use Try::Tiny;
use constant DEFAULT_STARTWAIT_SECS => 1;
use constant DEFAULT_STOPWAIT_SECS => 2;
use constant DEFAULT_MAX_RETRIES => 8;
use constant BASE_BACKOFF_DELAY => 0.3;
use Object::Tiny qw{
name
desc
proxy
state
pid
start_time
stop_time
running_cmd
cmd
env
cwd
tags
tie_stdin_to
ignore_stderr
ignore_stdout
startwait_secs
stopwait_secs
respawn_on_fail
respawn_on_stop
respawn_max_retries
no_new_session
user
group
priority
};
=pod
=head1 NAME
ControlFreak::Service - Object representation of a service.
=head1 SYNOPSIS
my $mc = ControlFreak::Service->new(
name => "memcached",
desc => "you should have this one...",
ignore_stderr => 1,
cmd => "/usr/bin/memcached",
);
my $fcgisock = $ctrl->socketmap->{fcgi};
my $web = ControlFreak::Service->new(
name => "fcgi",
desc => "I talk http",
tie_stdin_to => $fcgisock,
cmd => "/usr/bin/plackup -a MyApp -s FCGI",
);
$web->up;
$web->start;
$web->stop;
( run in 0.629 second using v1.01-cache-2.11-cpan-39bf76dae61 )