Daemonise - Daemonise - a general daemoniser for anything...
version 2.13
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
This is a stub that can be extended by plugins like HipChat and Slack
stub method to hook into by plugins
method hook for redirecting STDOUT/STDERR in plugins most recent loaded plugin takes precedence using around modifier only
around
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).
Please report any bugs or feature requests on GitHub's issue tracker https://github.com/ideegeo/Daemonise/issues.
You can find documentation for this module with the perldoc command.
perldoc Daemonise
You can also look for information at:
GitHub repository
https://github.com/ideegeo/Daemonise
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/Daemonise
CPAN Ratings
http://cpanratings.perl.org/d/Daemonise
Lenz Gschwendtner <norbu09@cpan.org>
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.
To install Daemonise, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Daemonise
CPAN shell
perl -MCPAN -e shell install Daemonise
For more information on module installation, please visit the detailed CPAN module installation guide.