Permalink
Browse files

added cleanup empty year dirs to reap_old_logs

Change-Id: I2c4e10caded5270bfd8cda9db3c235f789ed6c32
  • Loading branch information...
1 parent 020632c commit 6f197294d3e9480d8f714f70c3cc195666c1dec3 thansmann committed Oct 9, 2012
Showing with 5 additions and 3 deletions.
  1. +5 −3 jobs/syslog_aggregator/templates/reap_old_logs
@@ -19,9 +19,11 @@ EGREP_FORMAT_DAYS_TO_EXCLUDE=$(echo $DAYS_TO_EXCLUDE | tr ' ' '|')
find ${LOG_DIR} -mmin +${MIN_TO_KEEP} -name '*.log.gz' -exec rm -f '{}' \;
-# Reap empty dirs in 2 passes, one to clear empty 'day' dirs and a
-# second to clear empty 'month' dirs
-for i in '/[0-9]{4}/[0-1][0-9]/[0-9]{2}' '/[0-9]{4}/[0-1][0-9]'; do
+# Reap empty dirs in 3 passes, clear empty 'day' dirs, then 'month'
+# and lastly 'year'
+for i in '/[0-9]{4}/[0-1][0-9]/[0-9]{2}$' \
+ '/[0-9]{4}/[0-1][0-9]$' \
+ '/[0-9]{4}$'; do
/usr/bin/find ${LOG_DIR} -type d -empty |
egrep -v "${EGREP_FORMAT_DAYS_TO_EXCLUDE}" |
egrep ${i} |

0 comments on commit 6f19729

Please sign in to comment.