Permalink
Browse files

Merge "added cleanup empty year dirs to reap_old_logs"

  • Loading branch information...
2 parents 91d2230 + 6f19729 commit 79908eeb033c2277e91e5e15926f2301244cad07 thansmann committed with Gerrit Code Review 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 79908ee

Please sign in to comment.