Changeset 195 for trunk

Show
Ignore:
Timestamp:
11/09/10 22:19:00 (3 years ago)
Author:
depesz
Message:

Make archive_logs work correctly with log prefixes that contain - character.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/tools/archive_logs.sh

    r176 r195  
    276276 
    277277        # Extract year and month from log filename - to be used in archive path 
    278         YEAR_MONTH=$( echo "$FILENAME" | cut -d- -f2,3 ) 
     278        # ${FILENAME:${#PREFIX}} extracts part of filename after prefix. 
     279        # i.e. with prefix == "a-b", and filename being a-b-2010-10-11, it 
     280        # returns -1010-10-11 
     281        # This is done to allow - character in prefixes, yet to still make 
     282        # the cut below to extract what we need. 
     283        YEAR_MONTH=$( echo "${FILENAME:${#PREFIX}}" | cut -d- -f2,3 ) 
    279284        if [[ ! -d "$ARCHIVE_DIR/$YEAR_MONTH" ]] 
    280285        then