Created
December 4, 2019 17:54
-
-
Save alanef/4571cf10a4514425ac7f9818dd90abb5 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 | |
| BUCKET=$1 | |
| if [ -z "$BUCKET" ] | |
| then | |
| echo "-bucket must be specified" | |
| exit 1; | |
| fi | |
| d=`date +%Y-%m-%d` | |
| wproot="${HOME}/public_html" # change this to your actual wordpress directory | |
| echo "`date`" - WordPress Backup started | |
| cd ${wproot} | |
| wp db export --add-drop-table - > "${HOME}/tmp/wordpress-${d}.sql" | |
| aws s3 cp "${HOME}/tmp/wordpress-${d}.sql" s3://${BUCKET} | |
| rm "${HOME}/tmp/wordpress-${d}.sql" | |
| tar -czf - -C ${wproot} . > "${HOME}/tmp/wordpress-${d}.tar.gz" | |
| aws s3 cp "${HOME}/tmp/wordpress-${d}.tar.gz" s3://${BUCKET} | |
| rm "${HOME}/tmp/wordpress-${d}.tar.gz" | |
| echo "`date`" - WordPress Backup ended |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment