Daemon-Control

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

    * fixed a warning on "uninitialized value $called_with in substitution"
      (Kromg)

    * include the date and module version in the generated init file
      (Karen Etheridge)

    * warn is used rather than printing to STDERR
    * new commands: help, reload
    * new options: kill_timeout, umask, init_code, do_help
    * new functions: do_help, do_reload, trace
    * pid file is now written as the current user, then chowned to the target user
    * pid file is now written when single-forking
    * gid is calculated when not provided but the uid is, avoiding some
      warnings

0.000009  2012-04-19 SymKat <symkat@symkat.com>
    * Stole Moo's MANIFEST.SKIP

0.000008  2012-04-19 SymKat <symkat@symkat.com>
    * Added Makefile to MANIFEST.SKIP

lib/Daemon/Control.pm  view on Meta::CPAN


sub write_pid {
    my ( $self ) = @_;

    # Create the PID file as the user we currently are,
    # and change the permissions to our target UID/GID.

    $self->_write_pid;

    if ( $self->uid && $self->gid ) {
        chown $self->uid, $self->gid, $self->pid_file;
        $self->trace("PID => chown(" . $self->uid . ", " . $self->gid .")");
    }
}

sub _write_pid {
    my ( $self ) = @_;

    my ($volume, $dir, $file) = File::Spec->splitpath($self->pid_file);
    return 0 if not $self->_create_dir($dir);

    open my $sf, ">", $self->pid_file

lib/Daemon/Control.pm  view on Meta::CPAN


The location of the PID file to use.  Warning: if using single-fork mode, it is
recommended to set this to the file which the daemon launching in single-fork
mode will put its PID.  Failure to follow this will most likely result in status,
stop, and restart not working.

    $daemon->pid_file( "/var/run/mydaemon/mydaemon.pid" );

=head2 resource_dir

This directory will be created, and chowned to the user/group provided in
C<user>, and C<group>.

    $daemon->resource_dir( "/var/run/mydaemon" );

=head2 prereq_no_process -- EXPERIMENTAL

This option is EXPERIMENTAL and defaults to OFF.

If this is set, then the C<ps> list will be checked at startup for any
processes that look like the daemon to be started.  By default the pattern used



( run in 0.703 second using v1.01-cache-2.11-cpan-71847e10f99 )