Merge pull request #27 from karenetheridge/topic/init_config_perlbrew

Better init file generation - Thanks =)
This commit is contained in:
SymKat 2012-09-03 12:10:56 -07:00
commit c3115593a1
2 changed files with 8 additions and 4 deletions

View file

@ -8,5 +8,6 @@ license 'perl';
# Specific dependencies # Specific dependencies
requires 'File::Spec' => '0'; requires 'File::Spec' => '0';
requires 'POSIX' => '0'; requires 'POSIX' => '0';
requires 'Cwd' => '0';
WriteAll; WriteAll;

View file

@ -4,6 +4,7 @@ use strict;
use warnings; use warnings;
use POSIX qw(_exit setsid setuid setgid getuid getgid); use POSIX qw(_exit setsid setuid setgid getuid getgid);
use File::Spec; use File::Spec;
use Cwd 'abs_path';
require 5.008001; # Supporting 5.8.1+ require 5.008001; # Supporting 5.8.1+
our $VERSION = '0.000009'; # 0.0.9 our $VERSION = '0.000009'; # 0.0.9
@ -379,7 +380,7 @@ sub dump_init_script {
REQUIRED_STOP => $self->lsb_stop ? $self->lsb_stop : "", REQUIRED_STOP => $self->lsb_stop ? $self->lsb_stop : "",
SHORT_DESCRIPTION => $self->lsb_sdesc ? $self->lsb_sdesc : "", SHORT_DESCRIPTION => $self->lsb_sdesc ? $self->lsb_sdesc : "",
DESCRIPTION => $self->lsb_desc ? $self->lsb_desc : "", DESCRIPTION => $self->lsb_desc ? $self->lsb_desc : "",
SCRIPT => $self->path ? $self->path : $0, SCRIPT => $self->path ? $self->path : abs_path($0),
INIT_SOURCE_FILE => $init_source_file, INIT_SOURCE_FILE => $init_source_file,
} }
)); ));
@ -576,8 +577,7 @@ If provided, chdir to this directory before execution.
The path of the script you are using Daemon::Control in. This will be used in The path of the script you are using Daemon::Control in. This will be used in
the LSB file genration to point it to the location of the script. If this is the LSB file genration to point it to the location of the script. If this is
not provided $0 will be used, which is likely to work only if you use the full not provided, the absolute path of $0 will be used.
path to execute it when asking for the init script.
=head2 init_config =head2 init_config
@ -587,6 +587,9 @@ a PERL5LIB and such things.
$daemon->init_config( "/etc/default/my_program" ); $daemon->init_config( "/etc/default/my_program" );
If you are using perlbrew, you probably want to set your init_config to
C<$ENV{PERLBREW_ROOT} . '/etc/bashrc'>.
=head2 redirect_before_fork =head2 redirect_before_fork
By default this is set true. STDOUT will be redirected to stdout_file, By default this is set true. STDOUT will be redirected to stdout_file,