Cron job to fully backup wordpress automatically

If you’re using wordpress, chance are you’re using Updraft plugin for backup and restore purpose, but it doesn’t always working with automatic backup especially some host may disable wordpress cronjob. So it’s better to create a manual cronjob as following:

In the wordpress installation folder, create a backup.php with this content:

<?php

define('UPDRAFTPLUS_CONSOLELOG', true);
define('DOING_CRON', true);
require_once('wp-load.php');
do_action('updraft_backupnow_backup_all');

Now create a cron job to run this file eg at 2AM everyday:

crontab -e
0 2 * * * /bin/php /var/www/public_html/wordpress_website/backup.php
esc :wq Enter

Add to my src(0)

No account yet? Register