GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  UBIC::SERVICE::SIMPLEDAEMON (3)

.ds Aq ’

NAME

Ubic::Service::SimpleDaemon - service module for daemonizing any binary

CONTENTS

VERSION

version 1.58

SYNOPSIS



    use Ubic::Service::SimpleDaemon;
    my $service = Ubic::Service::SimpleDaemon->new(
        bin => "sleep 1000",
        stdout => "/var/log/sleep.log",
        stderr => "/var/log/sleep.err.log",
        ubic_log => "/var/log/sleep.ubic.log",
        user => "nobody",
    );



DESCRIPTION

Use this class to turn any binary into ubic service.

This module uses Ubic::Daemon module for process daemonization. All pidfiles are stored in ubic data dir, with their names based on service names.

METHODS

<B>new($params)B> Constructor.

Parameters:
bin Daemon binary.

Can be a plain string (i.e., sleep 10000), or arrayref with separate arguments (i.e., [sleep, 1000]).

This is the only mandatory parameter, everything else is optional.

user User under which the service will operate.

Default user depends on the configuration chosen at ubic-admin setup stage. See Ubic::Settings for more details.

group Group under which the service will operate.

Value can be either scalar or arrayref.

Defaults to all groups of service’s user.

stdout File into which daemon’s stdout will be redirected. None by default.
stderr File into which daemon’s stderr will be redirected. None by default.
ubic_log Optional filename of ubic log. Log will contain some technical information about running daemon.

None by default.

cwd Change working directory before starting a daemon.
env Modify environment before starting a daemon.

Must be a plain hashref if specified.

ulimit Set resource limits before starting a daemon.

Must be a plain hashref with resource names as keys if specified. For example: ulimit => { RLIMIT_NOFILE => 100 }. Pass -1 as a value to make the resource unlimited.

These limits won’t affect anything outside of this service code.

If your service’s user is root and daemon_user is something else, you can not just lower limits but raise them as well.

BSD::Resource must be installed to use this feature.

term_timeout Number of seconds to wait between sending SIGTERM and SIGKILL to the daemon on stopping.

Zero value means that guardian will send SIGKILL to the daemon immediately.

Default is 10 seconds.

stop_timeout Number of seconds to wait before raising exception that daemon can’t be stopped.

This should always be greater than term_timeout, and defaults to 30 seconds (via Ubic::Daemon’s defaults.)

reload_signal Send given signal to the daemon on reload command.

Can take either integer value or signal name (i.e., HUP).

The signal will be sent both to the daemon, and to the guardian process. Guardian process will have proxy_logs feature enabled, so it’ll reopen stdout, stderr and ubic_log as well.

daemon_user
daemon_group Change credentials to the given user and group before execing into daemon.

The difference between these options and user/group options is that for daemon_* options, credentials will be set just before starting the actual daemon. All other service operations will be done using default user. Refer to Permissions and security in Ubic::Manual::Overview for the further explanations.

name Service’s name.

Name will usually be set by upper-level multiservice. Don’t set it unless you know what you’re doing.

auto_start Autostart flag is off by default. See Ubic::Service auto_start method for details.

<B>B>pidfile()<B>B> Get pid filename. It will be concatenated from simple-daemon pid dir and service’s name.

CUSTOM COMMANDS

All services using this class support two custom commands: sigusr1 and sigusr2. So, ubic sigusr1 your.service.name will send SIGUSR1 to your daemon (and also send SIGHUP to ubic-guardian, which can result in reopening log files.)

SEE ALSO

Ubic::Daemon - module for daemonizing any binary.

AUTHOR

Vyacheslav Matyukhin <mmcleric@yandex-team.ru>

COPYRIGHT AND LICENSE

This software is copyright (c) 2015 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.

Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 UBIC::SERVICE::SIMPLEDAEMON (3) 2015-01-27

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.