Backup WordPress site using Dropbox and wp-cli ?

โ€”

by

in

Here is how you can backup small site using wp-cli and dropbox.

Go to: https://www.dropbox.com/developers/apps

Create new app call it anything it’s gonna be your private app.

Generated access token and save it somewhere in your locker ๐Ÿ™‚

Download file backup-site.sh and change directories path and DROPBOX_TOKEN

sudo chmod +x backup-site.sh

Setup crontab with crontab -e add following line there

0 5 * * * /root/backup-sites.sh > /dev/null 2>&1

This will backup site everyday at 5 am.

Notes:

  • This scripts assumes your installation will be under example.com/htdocs if not it’s time to fork this and modify script.
  • This will backup your WP tables and wp-content folder.
  • You can also change path of backup-sites.sh.
  • You should clean up your dropbox folder before you run out of memory.
  • Modify crontab if you want to change backup interval to less frequent or more frequent.

Credit:


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *