/Daemonise

Daemonise - a general daemoniser for anything...

Primary LanguagePerl

NAME

Daemonise - Daemonise - a general daemoniser for anything...

VERSION

version 2.14

SYNOPSIS

use Daemonise;
use File::Basename;

my $d = Daemonise->new();
$d->name(basename($0));

# log/print more debug info
$d->debug(1);

# stay in foreground, don't actually fork when calling $d->start
$d->foreground(1) if $d->debug;

# config file style can be whatever Config::Any supports
$d->config_file('/path/to/some.conf');

# where to store/look for PID file
$d->pid_file("/var/run/${name}.pid");

# configure everything so far
$d->configure;

# fork and redirect STDERR/STDOUT to syslog per default
$d->start;

# load some plugins (refer to plugin documentation for provided methods)
$d->load_plugin('RabbitMQ');
$d->load_plugin('CouchDB');
$d->load_plugin('JobQueue');
$d->load_plugin('Event');
$d->load_plugin('Redis');
$d->load_plugin('HipChat');
$d->load_plugin('Riemann');
$d->load_plugin('PagerDuty');
$d->load_plugin('KyotoTycoon');
$d->load_plugin('Graphite');

# reconfigure after loading plugins if necessary
$d->configure;

# do stuff

ATTRIBUTES

name

hostname

config_file

config

debug

start_time

is_cron

cache_plugin

print_log

SUBROUTINES/METHODS

new

load_plugin

configure

async

log

notify

This is a stub that can be extended by plugins like HipChat and Slack

start

stub method to hook into by plugins

stop

round

dump

stdout_redirect

method hook for redirecting STDOUT/STDERR in plugins most recent loaded plugin takes precedence using around modifier only

build_hostname

DEPLOY PROCESS

This module uses Dist::Zilla for the release process. To get it up and running do the following:

cpanm Dist::Zilla
git clone https://github.com/ideegeo/Daemonise
cd Daemonise
dzil authordeps --missing | cpanm
dzil listdeps --author --develop | cpanm

At this point all required plugins for Dist::Zilla and modules to run tests should be installed. Daemonise uses PGP signed github releases, so make sure your git config user and email are setup correctly as well as a PGP key that matches your git(hub) account email. Try Config::Identity for a PGP encrypted file of your github account credentials in ~/.github for convenience. Finally run:

dzil release

which will do all the work (build, test, sign, tag, update github, upload).

BUGS

Please report any bugs or feature requests on GitHub's issue tracker https://github.com/ideegeo/Daemonise/issues.

SUPPORT

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

perldoc Daemonise

You can also look for information at:

ACKNOWLEDGEMENTS

AUTHOR

Lenz Gschwendtner <norbu09@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2013 by Lenz Gschwendtner.

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