Daemon-Control/t/bin/03_perl_gets_control.pl
SymKat 06a746a797 0.0.2 2012-18-12 SymKat <symkat@symkat.com>
* Default fork mode changed to double.
    * Added show_warnings command instead of alerting
      about DWIM actions.
    * Fatal warnings changed from warn+exit to die (exits non-zero)
    * _fork handles undef/cannot fork.
    * $self->redirect_filehandles added
    * redirect_before_fork added (default 1)
    * With a code ref, $self is passed (can $control->redriect_filehandles)
2012-02-18 04:11:18 -05:00

28 lines
695 B
Perl

#!/usr/bin/perl
use warnings;
use strict;
use Daemon::Control;
Daemon::Control->new({
name => "My Daemon",
lsb_start => '$syslog $remote_fs',
lsb_stop => '$syslog',
lsb_sdesc => 'My Daemon Short',
lsb_desc => 'My Daemon controls the My Daemon daemon.',
path => '/usr/sbin/mydaemon/init.pl',
program => sub {
if ( ref $_[0] ne 'Daemon::Control' ) {
print "FAILED\n";
}
},
program_args => [ ],
redirect_before_fork => 0,
pid_file => '/dev/null', # I don't want to leave tmp files for testing.
stderr_file => '/dev/null',
stdout_file => '/dev/null',
fork => 2,
})->run;