mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-14 15:33:49 +00:00
Fix spool file. Actually write run and send PID files.
This commit is contained in:
20
bin/pt-agent
20
bin/pt-agent
@@ -5674,6 +5674,14 @@ sub run_service {
|
||||
if ( -f $pid_file && -s $pid_file ) {
|
||||
die "$pid_file exists, remove it if $service is not running";
|
||||
}
|
||||
else {
|
||||
open my $fh, '>', $pid_file
|
||||
or die "Error opening $pid_file: $OS_ERROR\n";
|
||||
print { $fh } $PID, "\n"
|
||||
or die "Error writing to $pid_file: $OS_ERROR\n";
|
||||
close $fh
|
||||
or warn "Error closing $pid_file: $OS_ERROR";
|
||||
}
|
||||
my $remove_pid_file = CleanupTask->new(
|
||||
sub {
|
||||
unlink $pid_file
|
||||
@@ -5731,8 +5739,8 @@ sub run_service {
|
||||
}
|
||||
|
||||
my @output_files;
|
||||
my $spool_file = int(time);
|
||||
my $abs_spool_file = "$spool_tmp/" . $service->name . "/$spool_file";
|
||||
my $spool_file = $service->name . '.' . int(time);
|
||||
my $abs_spool_file = "$spool_tmp/$spool_file";
|
||||
my $have_spool_file = 0;
|
||||
my $final_exit_status = 0;
|
||||
my $taskno = 0;
|
||||
@@ -5945,6 +5953,14 @@ sub send_data {
|
||||
if ( -f $pid_file && -s $pid_file ) {
|
||||
die "$pid_file exists, remove it if $service is not running";
|
||||
}
|
||||
else {
|
||||
open my $fh, '>', $pid_file
|
||||
or die "Error opening $pid_file: $OS_ERROR\n";
|
||||
print { $fh } $PID, "\n"
|
||||
or die "Error writing to $pid_file: $OS_ERROR\n";
|
||||
close $fh
|
||||
or warn "Error closing $pid_file: $OS_ERROR";
|
||||
}
|
||||
my $remove_pid_file = CleanupTask->new(
|
||||
sub {
|
||||
unlink $pid_file
|
||||
|
Reference in New Issue
Block a user