An open API service indexing awesome lists of open source software.

https://github.com/centralnicgroup-opensource/daemonise

Daemonise - a general daemoniser for anything...
https://github.com/centralnicgroup-opensource/daemonise

Last synced: 3 months ago
JSON representation

Daemonise - a general daemoniser for anything...

Awesome Lists containing this project

README

        

=pod

=encoding UTF-8

=head1 NAME

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

=head1 VERSION

version 2.14

=head1 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

=head1 ATTRIBUTES

=head2 name

=head2 hostname

=head2 config_file

=head2 config

=head2 debug

=head2 start_time

=head2 is_cron

=head2 cache_plugin

=head2 print_log

=head1 SUBROUTINES/METHODS

=head2 new

=head2 load_plugin

=head2 configure

=head2 async

=head2 log

=head2 notify

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

=head2 start

stub method to hook into by plugins

=head2 stop

=head2 round

=head2 dump

=head2 stdout_redirect

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

=head2 build_hostname

=head1 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).

=head1 BUGS

Please report any bugs or feature requests on GitHub's issue tracker L.

=head1 SUPPORT

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

perldoc Daemonise

You can also look for information at:

=over 4

=item * GitHub repository

L

=item * AnnoCPAN: Annotated CPAN documentation

L

=item * CPAN Ratings

L

=back

=head1 ACKNOWLEDGEMENTS

=head1 AUTHOR

Lenz Gschwendtner

=head1 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.

=cut