parallel: Only move the tmp-uptime file if 'uptime' succeeds

This commit is contained in:
Ole Tange 2011-06-27 22:51:01 +02:00
parent acfaa04f19
commit 76ae522c84

View file

@ -1971,7 +1971,7 @@ sub loadavg {
# save it to a tmp file before moving it to the correct file
my $file = $self->{'loadavg_file'};
my $tmpfile = $self->{'loadavg_file'}.$$;
qx{ ($uptime > $tmpfile; mv $tmpfile $file) & };
qx{ ($uptime > $tmpfile && mv $tmpfile $file) & };
}
return $self->{'loadavg'};
}