Even though Akeeba Backup makes it very easy to take a backup of your Joomla!™ site, it still requires you to log in to the site's backend, click on the button and wait for the backup to finish. If you do this daily, it is a drag. Our job is to automate your life, making repeated and time consuming procedures a breeze. To this end we offer not just one, but 3 (yes, THREE!) different backup automation possibilities for Akeeba Backup.
Only one of those options is available in the free (as in "free beer") Akeeba Backup Core release
This option is available in both the Akeeba Backup Core and Akeeba Backup Professional releases. You don't need to subscribe to the Professional edition to use it.
The front-end backup feature is intended to provide the capability to perform an unattended, scheduled backup of your site.
The front-end backup URL performs a single backup step and sends a redirection (HTTP 302) header to force the client to advance to the next page, which performs the next step and so forth. You will only see a message upon completion, should it be successful or not. There are a few limitations, though:
It is not designed to be run from a normal web browser, but from an unattended cron script, utilizing wget or cron as a means of accessing the function.
The script is not capable of showing progress messages.
Normal web browsers tend to be "impatient". If a web page returns a bunch of redirection headers, the web browser thinks that the web server has had some sort of malfunction and stop loading the page. It will also show some kind of "destination unreachable" message. Remember, these browsers are meant to be used on web pages which are supposed to show some content to a human. This behaviour is normal. Most browsers will quit after they encounter the twentieth page redirect response, which is bound to happen. Do not come to the Free Support Forum complaining that Firefox, Internet Explorer, Chrome, Safari, Opera or another browser doesn't work with the front-end backup feature. It was NOT meant to work by design.
Command line utilities, by default, will also give up loading a page after it has been redirected a number of times. For example, wget gives up after 20 redirects, curl does so after 50 redirects. Since Akeeba Backup redirects once for every step, it is advisable to configure your command line utility with a large number of redirects; about 10000 should be more than enough for virtually all sites.
Do you want to automate your backups despite your host not supporting CRON? Webcron.org fully supports Akeeba Backup's front-end backup feature and is dirt cheap - you need to spend about 1 Euro for 1000 backup runs. Just make sure you set up your Webcron CRON job time limit to be at least 10% more than the time it takes for Akeeba Backup to backup your site. Don't know how much is that? No problem! Just take a regular backup from your site's back-end, then go to Manage Backups (formerly "Administer Backup Files") page and take a look at the Duration column. That's what you're looking for!
Before beginning to use this feature, you must set up Akeeba
Backup to support the front-end backup option. First, go to Akeeba
Backup's main page and click on the Enable front-end and remote backup and set it
Yes. Below it, you will find the option named
Secret key. In that box you have to enter a
password which will allow your CRON job to convince Akeeba Backup
that it has the right to request a backup to be taken. Think of it
as the password required to enter the VIP area of a night club.
After you're done, click the Save button on top to save the settings
and close the dialog.
Use only lower- and upper-case alphanumeric characters (0-9, a-z, A-Z) in your secret key. Other characters may need to be manually URL-encoded in the CRON job's command line. This is error prone and can cause the backup to never start even though you'll be quite sure that you have done everything correctly.
Most hosts offer a CPanel of some kind. There has to be a section for something like "CRON Jobs", "scheduled tasks" and the like. The help screen in there describes how to set up a scheduled job. One missing part for you would be the command to issue. Simply putting the URL in there is not going to work.
If your host only supports entering a URL in their "CRON" feature, this will most likely not work with Akeeba Backup. There is no workaround. It is a hard limitation imposed by your host. We would like to help you, but we can't. As always, the only barrier to the different ways we can help you is server configuration.
If you are on a UNIX-style OS host (usually, a Linux host) you most probably have access to a command line utility called wget. It's almost trivial to use:
Of course, the line breaks are included for formatting clarity only. You should not have a line break in your command line!
Do not miss the --max-redirect=10000 part of the wget command! If you fail to include it, the backup will not work with wget complaining that the maximum number of redirections has been reached. This is normal behavior, it is not a bug.
Do not forget to surround the URL in double quotes. If you don't the backup will fail and it will be your fault! The reason is that the ampersand is also used to separate multiple commands in a single command line. If you don't use the double quotes at the start and end of the backup URL, your host will think that you tried to run multiple commands and load your site's homepage instead of the front-end backup URL.
If you're unsure, check with your host. Sometimes you have to get from them the full path to wget in order for CRON to work, thus turning the above command line to something like:
Contact your host; they usually have a nifty help page for all this stuff. Read also the section on CRON jobs below.
Optionaly, you can also include an extra parameter to the
profile_id is the numeric ID of the
profile you want to use for the backup. If you don't specify this
parameter, the default backup profile (ID=1) will be used. In this
sense, the aforementioned URL becomes:
wget is multi-platform command line
utility program which is not included with all operating systems. If
your system does not include the
command, it can be downloaded at this address: http://wget.addictivecode.org/FrequentlyAskedQuestions#download.
wget homepage is here: http://www.gnu.org/software/wget/wget.html.
Please note that the option
wget version 1.11 and
Using a web browser (Internet Explorer, Google Chrome, ...)
The ampersands above should be written as a single ampersand, not as an HTML entity (&). Failure to do so will result in a 403: Forbidden error message and no backup will occur. This is not a bug, it's the way wget works.
Assuming that you have already bought some credits on webcron.org, here's how to automate your backup using their service.
First, go to Akeeba Backup's main page (Control
Panel) and click on the button. Find the option titled
Enable front-end and remote backup and set it
Yes. Below it, you will find the option named
Secret key. Type in a secret key. We strongly
recommend using only alphanumeric characters, i.e. 0-9, a-z and A-Z.
For the sake of this example, we will assume that you have entered
ak33b4s3cRet in that field. We will also assume
that your site is accessible through the URL
Log in to webcron.org. In the CRON area, click on thebutton. Here's what you have to enter at webcron.org's interface:
Name of cronjob: anything you like, e.g. "Backup www.example.com"
Timeout: 180sec; if the backup doesn't complete, increase it. Most sites will work with a setting of 180 or 600 here. If you have a very big site which takes more than 5 minutes to back itself up, you might consider using Akeeba Backup Professional and the native CRON script (akeeba-backup.php) instead, as it's much more cost-effective.
Url you want to execute:
Login and Password: Leave them blank
Execution time (the grid below the other settings): Select when you want your CRON job to run
Alerts: If you have already set up alert methods in webcron.org's interface, we recommend choosing an alert method here and not checking the "Only on error" so that you always get a notification when the backup CRON job runs.
Now click onand you're all set up!
As user DrChalta pointed out in a forum post, there is an alternative to wget, as long as your PHP installation has the cURL extension installed and enabled. For starters, you need to save the following PHP script as backup.php somewhere your host's cron feature can find it. Please note that this is a command-line script and needn't be located in your site's root; it should be preferably located above your site's root, in a non web-accessible directory.
The script below is a modification over DrChalta's original script, taking into account changes made in later versions of our software. In order to configure it for your server, you only have to change the first three lines.
<?php define('SITEURL', 'http://www.example.com'); // Base URL of your site define('SECRETKEY', 'MySecretKey'); // Your secret key define('PROFILE',1); // The profile's ID // ====================== DO NOT MODIFY BELOW THIS LINE ====================== $curl_handle=curl_init(); curl_setopt($curl_handle,CURLOPT_URL, SITEURL.'/index.php?option=com_akeeba&view=backup&key='. SECRETKEY.'&profile='.PROFILE); curl_setopt($curl_handle,CURLOPT_FOLLOWLOCATION,TRUE); curl_setopt($curl_handle,CURLOPT_MAXREDIRS,10000); # Fix by Nicholas curl_setopt($curl_handle,CURLOPT_RETURNTRANSFER,1); $buffer = curl_exec($curl_handle); curl_close($curl_handle); if (empty($buffer)) echo "Sorry, the backup didn't work."; else echo $buffer; ?>
YourSecretKey should be set up as
discussed in the previous section.
The ampersands above should be written as a single ampersand, not as an HTML entity (&). Failure to do so will result in a 403: Forbidden error message and no backup will occur. This is not a bug, it's the way wget and PHP work.
In order to call this script with a schedule, you need to put something like this to your crontab (or use your host's CRON feature to set it up):
0 3 * * 6
/usr/local/bin/php is the
absolute path to your PHP command-line executable and
/home/USER/backups/backup.php is the
absolute path to the script above.
If you set up your cron schedule with a
visual tool (for example, a web interface), the command to execute
part is "
Thank you DrChalta for this wonderful tip!
As one of our users pointed out in the support forum, finding the correct command to issue for the CRON job is tricky. What he writes applies not only to his host, SiteGround, but many other commercial hosts as well. We'll simply quote our user, bzcoder.
In the CPanel for SiteGround there is a cronjob option, you create a cronjob using that and use:
curl -b /tmp/cookies.txt -c /tmp/cookies.txt -L
--max-redirs 1000 -v
as your command.
<url> with your
backup URL. Make sure to use the initial url displayed on the
backend NOT the final URL when you run the backup manually (been
there, done that) - when you do that you end up with a url that
doesn't work because of the extra parameter used in continuing the