JIP-Daemon
view release on metacpan or search on metacpan
lib/JIP/Daemon.pm view on Meta::CPAN
use JIP::Daemon;
my $proc = JIP::Daemon->new;
# Send program to backgroung.
$proc = $proc->daemonize;
# In the backgroung process:
$proc->is_detached; # 1
$proc->try_kill(0); # 1
printf qq{pid(%s), is_alive(%d), is_detached(%d)\n}, $proc->status;
# If the program is already a running background job, the daemonize method shall have no effect.
$proc = $proc->daemonize;
Dry run:
use JIP::Daemon;
my $proc = JIP::Daemon->new(dry_run => 1);
lib/JIP/Daemon.pm view on Meta::CPAN
=head2 drop_privileges
my $proc = JIP::Daemon->new(uid => 1000, gid => 1000, umask => 0, cwd => q{/});
$proc = $proc->drop_privileges;
Change C<uid>/C<gid>/C<umask>/C<cwd> on demand.
=head2 try_kill
my $is_alive = $proc->try_kill(0);
This is identical to Perl's builtin C<kill()> function for sending signals to processes (often to terminate them).
=head2 change_program_name
my $proc = JIP::Daemon->new(program_name => 'tratata');
$proc = $proc->change_program_name;
Changes the name of the program.
=head2 status
my ($pid, $is_alive, $is_detached) = $proc->status;
Returns a list of process attributes: PID, is alive, is detached (in backgroung).
=head1 DIAGNOSTICS
None.
=head1 CONFIGURATION AND ENVIRONMENT
C<JIP::Daemon> requires no configuration files or environment variables.
=head1 SEE ALSO
( run in 1.235 second using v1.01-cache-2.11-cpan-39bf76dae61 )