Created
August 12, 2016 07:27
-
-
Save solidpple/64b5fa64e30f2a6f80961c9c49a4ba9a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| LOG_PATH="/home/banana/logs/" | |
| VERSION_ARR=("0.01") | |
| for VERSION in "${VERSION_ARR[@]}" | |
| do | |
| echo "VERSION : " $VERSION | |
| TODAY=`date "+%Y%m%d"` | |
| LS_RESULT=$(ls -1 $LOG_PATH/$VERSION-completed/* | sed -e "s/.log$/.zip/g") | |
| LOGFILE="" | |
| LOGFILES="" | |
| BUCKET_HEAD="s3://" | |
| BUCKET_NAME="banana-${VERSION}/" | |
| echo $LOGPATH | |
| for ZIPFILE in $(s3cmd ls "${BUCKET_HEAD}${BUCKET_NAME}" | awk -F" " '{print $4;}' | awk -F"/" '{print $4;}') | |
| do | |
| COUNT=`echo "$LS_RESULT" | grep $ZIPFILE | wc -l` | |
| if [ $COUNT -eq 0 ] | |
| then | |
| echo $ZIPFILE | |
| # mkdir only if a dir does no alread exist | |
| mkdir -p "${VERSION}" 2>/dev/null | |
| python decrypter.py $LOG_PATH $VERSION $ZIPFILE $BUCKET_NAME | |
| # mkdir only if a dir does no alread exist | |
| mkdir -p "${LOG_PATH}/${VERSION}/" 2>/dev/null | |
| mv "${VERSION}/${ZIPFILE}" "${LOG_PATH}/${VERSION}/" | |
| (cd "$LOG_PATH/$VERSION"; unzip -u $ZIPFILE; rm -f $ZIPFILE; rm -f log*txt) | |
| LOGFILE="${ZIPFILE%.*}.log" | |
| fi | |
| done | |
| done | |
| mkdir -p "${LOG_PATH}/${VERSION}-exception/" | |
| mv "$LOG_PATH/$VERSION/"exception* "$LOG_PATH/${VERSION}-exception" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment