Beekeeper::WorkerPool::Daemon - Daemonize processes
Version 0.09
package MyDaemon; use base 'Beekeeper::WorkerPool::Daemon'; sub main { my $self = shift; my $quit = 0; $SIG{'TERM'} = sub { $quit = 1 }; $SIG{'INT'} = sub { $quit = 1 }; while (!$quit) { # Do something here... sleep 1; } }
Then, the daemon can be executed with a script like this:
#!/usr/bin/perl -wT use strict; use warnings; use MyDaemon; $ENV{PATH} = '/bin'; # untaint my $daemon = MyDaemon->new->run;
This is a base module for creating daemons. It takes care of daemonization tasks commonly found in init.d scripts: forking, redirecting output, writing pid files, start/stop/restart control commands, etc.
It is used by the command line tool bkpr to daemonize itself.
bkpr
José Micó, jose.mico@gmail.com
jose.mico@gmail.com
Copyright 2015-2023 José Micó.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language itself.
This software is distributed in the hope that it will be useful, but it is provided “as is” and without any express or implied warranties. For details, see the full text of the license in the file LICENSE.
To install Beekeeper, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Beekeeper
CPAN shell
perl -MCPAN -e shell install Beekeeper
For more information on module installation, please visit the detailed CPAN module installation guide.