WordPress Backup to GoogleDrive with cron job

Install UpdraftPlus plugin – https://wordpress.org/plugins/updraftplus/

Go to your Google API Dashboard and create a Google Drive API client & secret. You can follow this guide specific to Updraft.

In Settings -> Updraft set the files and backup retention days, then select Google Drive and insert client ID and secret:

Now you need to create a simple php script which will be launched from cron:

do_cron_backup.php
<?php
//define('UPDRAFTPLUS_CONSOLELOG', true);
define('DOING_CRON', true);

require_once('wp-load.php');
echo "Starting...";
do_action('updraft_backup_all');
echo "All done!";

Define a scheduled job to http://yourdomain.com/do_cron_backup.php in your preferred cron server. You should password protect the script execution.

I use the free CronJob service found at https://cron-job.org/, it’s reliable and easy to setup:

After the job, just check your Google Drive!

Aggiungi ai preferiti : Permalink.

Lascia un commento

Il tuo indirizzo email non sarà pubblicato.