Skip to content

Commit

Permalink
Ensure tidy's tar captures large numbers of files
Browse files Browse the repository at this point in the history
When a large number of files are being archived xargs might invoke
tar multiple times - overwriting the preceding tar archive. Using
the "--files-from" option to tar instead lets all files be correctly
archived.
  • Loading branch information
seanmil authored and npwalker committed Jan 25, 2019
1 parent 5848624 commit 786dfff
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion templates/tidy_cron.epp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ find "$DIR" -type f -ctime +$RETENTION_DAYS -delete
#compress files
cd "$DIR"
find . -type f -not -name "*.gz" -a -not -name "*.bz2" > "$DIR.tmp"
xargs -a "$DIR.tmp" tar -zcf "$DIR/$METRICS_TYPE-$(date +%Y.%m.%d.%H.%M.%S).tar.gz"
tar -zcf "$DIR/$METRICS_TYPE-$(date +%Y.%m.%d.%H.%M.%S).tar.gz" --files-from "$DIR.tmp"
xargs -a "$DIR.tmp" rm
rm "$DIR.tmp"

0 comments on commit 786dfff

Please sign in to comment.