In this article we will show you how to configure BackWPup schedules to run from the Server Cron on your dedicated server or linux host.
First of all WordPress uses wp-cron.php to run its scheduled tasks (plugin/theme update check) which is where BackWPup schedules will get added to.
Now wp-cron is only checked by your wordpress site when there is activity on it I.E someone visits the site.
So if you have a scheduled task for 7am and no one visit until 8pm in the evening, then the task will not run until that time.
How to get round this?
Most hosts have Cron (Cron is the proper time-based job scheduler) support on there hosting package (you need to check)and all you need to do is login through terminal (SSH) to add a schedule for it to checking with your site and make the site check if there are any schedules it should be running.
So for example I created a cron schedule to run at 7am on my host package which then triggers my site to run its schedules for that time or any its missed.
How Adding a Cron Schedule
This example is based on a Linux hosting package (1and1.co.uk)
1. Login through ssh
2. Type ‘crontan -l’ this will display any current schedules.
3. Type ‘crontab -e’ this will allow you to view/edit the crontab.
4. Go to the bottom (the last line of a line starting with a hash ‘#’ and press ‘i’ this allows you to insert/edit text.
5. Press ‘enter’ to start a new line.
6. Add the following command ‘* * * * * wget http://example.com/wp-cron.php?doing_wp_cron -O /dev/null > /dev/null’ adjust the line to point to your site, this line causes cron to retrieve the wp-cron page causing wordpress to check if there are any schedules to run.
7. Change the ‘* * * * *’ this is the schedule time currently it will run every single minute, each star breaks down Min/Hrs/Day_of_Month/Month/Day_of_Week, so 7am every day would be ‘0 7 * * *’
8. Press ‘escape’ this takes you out of edit mode.
9. type ‘:x’ and press ‘enter’ this will save an exit you back to the terminal.
10. All done your schedule will now run and cause WP-cron to run its schedules (which includes BackWPup if you made a schedule).
The Command ‘wget http://example.com/wp-cron.php?doing_wp_cron -O /dev/null > /dev/null’ has ‘ -O /dev/null > /dev/null’ at the end of it because if you do not add this it will either collect files in your host directory or keep emailing the page to the script user, so add line on the end tells it to retrieve the page but trash the data, as all we want is wordpress to think a user has gone to the site so it will check its schedule for anything to run.
All done hopefully this has cleared things up for other users.
Had to trawl the internet for a few hours to work out how to get my backups to work on time and I have posted this in a hope it will save your time as well.
External Sources I used to learn this: