Merged fix-1046440-pt-stalk-purge_samples

This commit is contained in:
Brian Fraser
2012-12-11 11:55:34 -03:00

View File

@@ -1189,6 +1189,11 @@ stalk() {
# There will not be enough disk space, so do not collect.
warn "Collect canceled because there will not be enough disk space after collecting another $margin MB"
fi
# Purge old collect files.
if [ -d "$OPT_DEST" ]; then
purge_samples "$OPT_DEST" "$OPT_RETENTION_TIME"
fi
fi
# ##################################################################
@@ -1204,13 +1209,13 @@ stalk() {
# Trigger/check/value is ok, sleep until next check.
sleep_ok "$OPT_INTERVAL"
fi
# Purge old collect file between checks.
if [ -d "$OPT_DEST" ]; then
purge_samples "$OPT_DEST" "$OPT_RETENTION_TIME"
fi
done
# One final purge of old collect files, but only if in collect mode.
if [ "$OPT_COLLECT" -a -d "$OPT_DEST" ]; then
purge_samples "$OPT_DEST" "$OPT_RETENTION_TIME"
fi
# Before exiting, the last collector may still be running.
# Wait for it to finish in case the tool is part of a script,
# or part of a test, so the caller has access to the collected