tests:webserver: reopen STDOUT/STDERR after locking pid file.
Michael
This commit is contained in:
parent
526c70f687
commit
449af292dc
@ -154,10 +154,6 @@ sub daemonize() {
|
||||
chdir "/" or die "daemonize: can't chdir to /: $!";
|
||||
open STDIN, "/dev/null" or
|
||||
die "daemonize: Can't read from /dev/null: $!";
|
||||
open STDOUT, ">> $access_log_file" or
|
||||
die "daemonize: Can't write to '$access_log_file': $!";
|
||||
open STDERR, ">> $error_log_file" or
|
||||
die "daemonize: Can't write to '$error_log_file': $!";
|
||||
|
||||
my $pid = fork();
|
||||
die "daemonize: can't fork: $!" if not defined($pid);
|
||||
@ -167,6 +163,13 @@ sub daemonize() {
|
||||
setsid or die "damonize: Can't create a new session: $!";
|
||||
}
|
||||
|
||||
sub reopen_logs() {
|
||||
open STDOUT, ">> $access_log_file" or
|
||||
die "daemonize: Can't write to '$access_log_file': $!";
|
||||
open STDERR, ">> $error_log_file" or
|
||||
die "daemonize: Can't write to '$error_log_file': $!";
|
||||
}
|
||||
|
||||
sub get_pid_lock() {
|
||||
open LOCKFILE, "> $pid_file" or
|
||||
die "Error opening pid-file $pid_file: $!";
|
||||
@ -191,8 +194,8 @@ $|=1; # autoflush
|
||||
process_options();
|
||||
|
||||
daemonize();
|
||||
|
||||
get_pid_lock();
|
||||
reopen_logs();
|
||||
|
||||
$SIG{CHLD} = \&REAPER;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user