Backup WordPress site using Dropbox and wp-cli ?

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:

Hello world!

My name is Utkarsh Patel (same as domain name no cheating) and I am WordPress Engineer. I also like to play with servers (DevOps maybe?).

This is my first blog. I’ve not decided to write a blog every x day or something which most people do.

Mostly, Blog will be on WordPress, JavaScript and Stuff which I find interesting.

To start with here are/were my favourite blogs on WordPress