Last active
March 5, 2018 20:53
-
-
Save martinvirtel/92a81caa384498db2eb61f9fdba205d8 to your computer and use it in GitHub Desktop.
Backup with S3 and WP All In One Migration Plugini
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 | |
# | |
# needs working aws cli | |
# needs working credentials for wordpress-backup profile to access $BACKUP_DST in ~/.aws/credentials | |
# needs this plugin: https://wordpress.org/plugins/all-in-one-wp-migration/ | |
export KEEP_FOR_DAYS=+10 | |
export WORDPRESS_NAME="dev.versicherungsmonitor.de" | |
export BACKUP_DST=s3://bucketname/wordpress_backups/$WORDPRESS_NAME/ | |
export WP_PATH=/var/www/dev.versicherungsmonitor.de/releases/current | |
export BACKUP_SRC=$WP_PATH/wp-content/ai1wm-backups/ | |
# Clean up older backups | |
find $BACKUP_SRC -mtime $KEEP_FOR_DAYS -exec rm {} \; | |
# Backup | |
wp --path=$WP_PATH ai1wm backup | |
# Push To Remote | |
aws --profile=wordpress-backup s3 sync $BACKUP_SRC $BACKUP_DST |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment