App-Daemon
view release on metacpan or search on metacpan
app-internal option settings by command line options. Order is now:
command line > app-internal > App::Daemon internal
(ms) [RT 51066] Applied patch by Mike Whitaker to point stdin/out/err
to /dev/null instead of closing them.
0.07 (10/08/2009)
(ms) Applied patch by Sadrak [rt:44513] to check if Log4perl has
already been initialized and skip the easy_init call in this
case. Note that -v then has to be handled by the user-provided
Log4perl configuration instead.
(ms) [RT 50326] Fixed insecure dependency error in tainted mode
by untainting the string obtained by appname().
0.06 (03/05/2009)
(ms) Added detach() as an importable method for simple daemons.
0.05 (02/17/2009)
(ms) Better docs as requested by Tim Appnel
(ms) docs on application-specific command line options
(ms) Better daemonization according to Stevens (Advanced Programming
in the UNIX environment)
(ms) Make sure the child isn't killed by a closed session before
}
}
return @procs;
}
###########################################
sub appname {
###########################################
my $appname = basename($0);
# Make sure -T regards it as untainted now
($appname) = ($appname =~ /([\w-]+)/);
return $appname;
}
###########################################
sub find_option {
###########################################
my($opt, $has_arg) = @_;
}
###########################################
sub pid_file_read {
###########################################
open FILE, "<$pidfile" or LOGDIE "Cannot open pidfile $pidfile";
flock FILE, LOCK_SH;
my $pid = <FILE>;
chomp $pid if defined $pid;
close FILE;
$pid =~ /^(\d+)$/; # Untaint
return $1;
}
###########################################
sub pid_file_process_running {
###########################################
if(! -f $pidfile) {
return undef;
}
my $pid = pid_file_read();
( run in 0.457 second using v1.01-cache-2.11-cpan-4e96b696675 )