Created
August 22, 2022 22:30
-
-
Save rachejazz/9f611b76ee12a0d8ba671a6221dd60bf to your computer and use it in GitHub Desktop.
transfers log files from an s3 bucket to another
This file contains 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
#this script transfers log files from s3 bucket to desired remote server | |
DIR = '~/var/logs' | |
COPIED_TO = '' | |
ssh remote_user@<IP> find $DIR -maxdepth <max depth here> -mtime -$1 -mtime +$2 -type f > loglist.txt | |
while read -r line | |
do | |
rsync -chavzP --stats [email protected]:$line $COPIED_TO | |
done < loglist.txt | |
aws s3 cp $COPIED_TO s3://bucket/ --recursive \ | |
--exclude "*" --include "*.txt" | |
rm loglist.txt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment