Vyacheslav Matyukhin > Ubic > Ubic::Service::Common

Download:
Ubic-1.57.tar.gz

Dependencies

Annotate this POD

Website

View/Report Bugs
Module Version: 1.57   Source  

NAME ^

Ubic::Service::Common - common way to construct new service by specifying several callbacks

VERSION ^

version 1.57

SYNOPSIS ^

    $service = Ubic::Service::Common->new({
        start => sub {
            # implementation-specific
        },
        stop => sub {
            # implementation-specific
        },
        status => sub {
            # implementation-specific
        },
        name => "my-service",
        port => 1234,
    });
    $service->start;

DESCRIPTION ^

Each service should provide safe start(), stop() and status() methods.

CONSTRUCTOR ^

Ubic::Service::Common->new($params)

Construct service object.

Possible parameters:

start

Mandatory sub reference providing service start mechanism.

stop

The same for stop.

status

Mandatory sub reference checking if service is alive.

It should return one of running, not running, broken values.

This code will be used as safety check against double start and in watchdog checks.

name

Service's name.

Optional, will usually be set by upper-level multiservice. Don't set it unless you know what you're doing.

user

User under which daemon will be started. Optional, default is root.

group

Group under which daemon will be started. Optional, default is all user groups.

Value can be scalar or arrayref.

port

Service's port.

AUTHOR ^

Vyacheslav Matyukhin <mmcleric@yandex-team.ru>

COPYRIGHT AND LICENSE ^

This software is copyright (c) 2013 by Yandex LLC.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

syntax highlighting: