3
# This script is used by Daemon.t because that test script
4
# cannot daemonize itself.
7
die "The MAATKIT_WORKING_COPY environment variable is not set. See http://code.google.com/p/maatkit/wiki/Testing"
8
unless $ENV{MAATKIT_WORKING_COPY} && -d $ENV{MAATKIT_WORKING_COPY};
9
unshift @INC, "$ENV{MAATKIT_WORKING_COPY}/common";
13
use warnings FATAL => 'all';
15
use English qw(-no_match_vars);
16
use constant MKDEBUG => $ENV{MKDEBUG};
22
my $o = new OptionParser(file => "$trunk/common/t/samples/daemonizes.pl");
26
if ( scalar @ARGV < 1 ) {
27
$o->save_error('No SLEEP_TIME specified');
30
$o->usage_or_errors();
33
if ( $o->get('daemonize') ) {
34
$daemon = new Daemon(o=>$o);
38
print STDERR "STDERR\n";
45
# ############################################################################
47
# ############################################################################
53
Usage: daemonizes.pl SLEEP_TIME [ARGS]
55
daemonizes.pl daemonizes, prints to STDOUT and STDERR, sleeps and exits.
59
This tool accepts additional command-line arguments. Refer to the
60
L<"SYNOPSIS"> and usage information for details.
66
Fork to background and detach (POSIX only). This probably doesn't work on
77
Print all output to this file when daemonized.
83
Create the given PID file when daemonized.