Created
March 19, 2018 12:00
-
-
Save mmilosheski/8415ed9cd42bbaa3d15a3370e5211452 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 | |
# wp-cli is mandatory in order this script to work | |
# call the script manually by running ./backup.sh | |
# or add the script to the crontab to run periodically | |
# it will create a dump of your database and .zip of your wp-content folder | |
cd /var/www/wordpress/ # path to your site | |
# Backup database | |
wp db export --database=staging backups/`date +%Y%m%d`_database.sql --add-drop-table | |
# Backup uploads directory | |
tar -zcf backups/`date +%Y%m%d`_uploads.tar.gz wp-content/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment