I do spend most of my time in developing my blog, writing useful content for blog readers and apart from those, I always try to find some thing new, easy to use and extremely useful for the people. To be in safe side from any disaster, I always keep the back up of my website (WordPress) database.
I use Wp-db-backup plugin for scheduling the database backup. There is a feature in that plugin that allows you to send the scheduled backup to your mentioned email address as attachment. But still there remains a danger! You can lost your email account. So it is wise to keep the backup file on your computer hard disk. You can do that manually. But I wanted the process to be automatic.
Here the Dropbox becomes the best choice. Storing your database backup in Dropbox will assure you about the availability of your important data as it will synchronize that files automatically to your computer. I searched the web for a plugin or script that allows to schedule the database backup and send it directly to the Dropbox account. But I could not found that I want! At last I am successful to schedule my WordPress blog database backup files to be uploaded in my Dropbox account.
How to Schedule WordPress Database Backup to be Sent in Dropbox Account
All the workaround is to arrange your Dropbox such that you can upload the email attachments to your Dropbox automatically. Send to Dropbox is a great application that allows you reach the above goal. So, go to “Send to Dropbox”
and allow the access to your Dropbox account. You will get a unique email ID after connecting your Dropbox with this application. Remember the address for future use. Read in details about the procedure.
Now you can forward any email with attachments to that address. So sign-in to your email account ( your Dropbox email account) and follow the steps.
Forwarding the email containing the database as attachment
1. Go to Settings > click on the “Filter” tab > select “Create a new filter”.
2. Now leave all the field blank except “Has the word” label. Put here the name of your database following by “_wp”. As example: your_data_wp.
[Note: It is best practice to backup a file from the plugin manually to your computer for checking the file name. Login to your WordPress admin panel and click on “Backup” under Tools menu (Assuming that you have installed Wp-db-backup plugin for your WordPress blog. If not, here is the download link. Though you can install any plugin that allows you to schedule the database backup and email the file as an attachment). Go to “Backup” option, choose “download to your computer” and click on “Backup now”.
After downloading to your computer pick the first 2-3 words. The filter in your email will be detect your backup files by those words when forwarding.]
3. Check in the box “Has attachment” > Click on “Next Step”.
4. Now to enable the “Forward it to” option click on Manage your forwarding addresses > Add a forwarding address.
5. In the pop-up box, put the email address that you got from the “Send to Dropbox” service and click Next.
6. A verification email containing your verification code will be sent to your Dropbox account. Wait for a while and copy the code.
7. Paste the code where it is required
and save the changes. It will redirect you at the filter creation wizard.
8. Click on “Create Filter”.
Working in WordPress admin panel
Again go to the Back up option as before. You can see the scheduling option by scrolling down the window. Chose the scheduling preferences, put the email address (where you’ve created the filter). Click on “Schedule backup”.
You are done! Now the backup file will be sent to your Dropbox at the scheduled intervals. You can find the database backup files at the “Attachment” folder in your Dropbox. The files will be stored at your Dropbox account as well as in your computer.
The above method is pretty well but bit complex and you need too many setups. That is why I was thinking for a long time that there should be some shortcut way to schedule Database backup to a Dropbox account. At last, I am happy to say that there is a shortcut to schedule database backup to Dropbox account using simple script. All you need to have the access of your hosting control panel and a Dropbox account.
Scheduling database backup to Dropbox using script
1. Download the script file from here and extract it at your local computer drive.
2. The extracted result is nothing but a folder named as “backup” which contains two files “backup.php” and “DropboxUploader.php”. Open the backup.php file with notepad and put the credentials of your Database and Dropbox account.
For a better organization at your Dropbox account, you can create a separate folder at your Dropbox account, say it as ‘Backup’ and put that at the backup.php file. Then the database will be backed-up at that folder.
Note: At the above image, the parts which are to be edited are highlighted.
3. Finish editing and save the file then upload the folder (backup) in a whole at your server location. Keep a note of the location relative to your server root (e.g ‘/home/user_name/public_html/…….’).
4. Login to your server control panel (cPanel) and search for the option for Corn jobs.
5. Click on the Corn jobs icon and create a new corn job. Here you can set the frequency of how often the corn job should be triggered which means the frequency of the backup. Put that as you like. Now write-down the following code at the command section:
Replace the “path-of-the-folder-backup” with the path on your server root.
6. Save the job and you are done! Now the database backup of your site will be saved at your Dropbox account.
Let us know which method do you love to follow.