Bug 942114: bad "find" usage in pt-stalk

This commit is contained in:
Brian Fraser fraserb@gmail.com
2012-08-13 12:39:28 -03:00
parent 217a45df6f
commit fdcbbb63fc
2 changed files with 27 additions and 7 deletions

View File

@@ -1031,14 +1031,14 @@ purge_samples() {
local retention_time="$2"
# Delete collect files which more than --retention-time days old.
find "$dir" -type f -mtime +$retention_time -exec rm -f '{}' \;
find "$dir" -warn -type f -mtime +$retention_time -exec rm -f '{}' \;
local oprofile_dir="/var/lib/oprofile/samples"
if [ -d "$oprofile_dir" ]; then
# "pt_collect_" here needs to match $CMD_OPCONTROL --save=pt_collect_$p
# in collect(). TODO: fix this
find "$oprofile_dir" -type d -name 'pt_collect_*' \
-depth -mtime +$retention_time -exec rm -rf '{}' \;
find "$oprofile_dir" -warn -depth -type d -name 'pt_collect_*' \
-mtime +$retention_time -exec rm -rf '{}' \;
fi
}