Created
December 19, 2012 17:55
-
-
Save steve21124/4338797 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 | |
# mirrors and uploads a wordpress blog to a static web site | |
# check http://x-ian.net for details | |
# my configs | |
LOCAL_WORDPRESS=x-ian.net | |
REMOTE_WORDPRESS=x-ian.net | |
SSH_LOGIN=<your ssh credentials> | |
REMOTE_HTTP_DIR=x-ian.net | |
# preparation | |
cd /tmp | |
rm -rf wordpress_mirror | |
mkdir wordpress_mirror | |
cd wordpress_mirror | |
# mirror of whole wordpress installation in static html pages | |
wget --mirror -R xmlrpc.php,trackback http://$LOCAL_WORDPRESS | |
# replace remaining links with real server | |
find ./$LOCAL_WORDPRESS -type f -exec sed -i "" "s/`echo $LOCAL_WORDPRESS`/`echo $REMOTE_WORDPRESS`/g" {} \; | |
# upload static html pages | |
cd $LOCAL_WORDPRESS | |
tar czf ../wordpress_mirror.tgz . | |
scp ../wordpress_mirror.tgz $SSH_LOGIN: | |
ssh $SSH_LOGIN "rm -rf x-ian.net; mkdir x-ian.net; cd x-ian.net; tar xzf ../wordpress_mirror.tgz" | |
# cleanup | |
rm -rf /tmp/wordpress_mirror* | |
ssh $SSH_LOGIN "rm wordpress_mirror.tgz" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment