Created
September 26, 2017 22:12
-
-
Save TonyFNZ/eb8233fe21ab730ccf196702fc87c72c to your computer and use it in GitHub Desktop.
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
#!/bin/bash | |
tempdir="blog-export/" | |
editdomain=editor.example.com | |
publishdomain=blog.example.com | |
# fail on any errors | |
set -e | |
# clean up previous run | |
rm -rf $tempdir | |
# generate static copy of the website | |
wget --mirror --cut-dirs=0 -P "$tempdir" -nv -nH -np -p -k -E --reject-regex "\?p=|xmlrpc" "http://$editdomain" | |
# Try to clean up domain names | |
grep -rl "http://$editdomain" $tempdir | xargs sed -i "s@$editdomain@$publishdomain@g" | |
# upload static content to S3 | |
aws s3 cp $tempdir "s3://$publishdomain" --region us-east-1 --recursive |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment