Support

Documentation

Checking for failed backups automatically

[Tip]Tip

This option is only available in the Akeeba Backup Professional releases. You need to subscribe to the Professional edition to use it.

While you can automate backups with any of the three methods above, there is a small drawback. It is impossible to catch a failed backup if the backup failure was caused by a PHP error or the server killing the backup script for any reason (usually: time, file size and memory limits). This has the unwanted side effect of not knowing when your backup has failed unless you keep track of the backup records on your sites or the emails sent out by your CRON jobs (if any are sent at all – it depends on the server / service you are using).

With Akeeba Solo you can automate the check for failed backups and have it email you when it detects that the latest backup has failed.

[Warning]Warning

This is an optional, advanced and DANGEROUS feature. If you check for failed backups while a backup is still running it is very possible that you will cause the backup to fail! We recommend scheduling backup checks a substantial amount of time (e.g. 1 hour) after the expected end time of your backups.

Front-end backup failure check, for use with CRON

[Tip]Tip

This option is only available in the Akeeba Backup Professional releases. You need to subscribe to the Professional edition to use it.

[Warning]Warning

This is an optional, advanced and DANGEROUS feature. If you check for failed backups while a backup is still running it is very possible that you will cause the backup to fail! We recommend scheduling backup checks a substantial amount of time (e.g. 1 hour) after the expected end time of your backups.

The front-end check feature is intended to provide the capability to perform an unattended, scheduled failed backup check.

Before beginning to use this feature, you must set up Akeeba Solo to support the front-end backup option. First, go to Akeeba Solo's main page and click on the System Configuration button, section Public API. Find the option titled Enable front-end and remote backup and set it to 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 Solo 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 & Close button on top to save the settings and close the dialog.

[Tip]Tip

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 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.

For Akeeba Solo it is something like this:

wget "http://www.yoursite.com/index.php?&view=check&key=YourSecretKey"

For Akeeba Backup for Wordpress it's something like this:

wget "http://www.yoursite.com/wp-admin/admin-cron.php?&action=akeebabackup_check&key=YourSecretKey"

[Warning]Warning

Do not forget to surround the URL in double quotes. If you don't, the check will fail to execute. 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.

[Important]Important

YourSecretKey must be URL-encoded. You can use an online tool like http://www.url-encode-decode.com or simply consult the Schedule Automatic Backups page.

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:

/usr/bin/wget "http://www.yoursite.com/index.php?&view=check&key=YourSecretKey"

or if you are using Wordpress it's something like:

/usr/bin/wget "http://www.yoursite.com/wp-admin/admin-cron.php?&action=akeebabackup_check&key=YourSecretKey"

Contact your host; they usually have a nifty help page for all this stuff. Read also the section on CRON jobs below.

wget is multi-platform command line utility program which is not included with all operating systems. If your system does not include the wget command, it can be downloaded at this address: http://wget.addictivecode.org/FrequentlyAskedQuestions#download. The wget homepage is here: http://www.gnu.org/software/wget/wget.html.

[Warning]Warning

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.

Using webcron.org to automate your failed backup checks

Assuming that you have already bought some credits on webcron.org, here's how to automate your failed backup checks using their service.

First, go to Akeeba Solo main page (Control Panel) and click on the System Configuration button. Find the option titled Enable front-end and remote backup and set it to 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 http://www.example.com.

Log in to webcron.org. In the CRON area, click on the New Cron button. 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: 30sec; if the failed backup check doesn't complete, increase it. Most sites will work with a setting of 60 or 90 here.

  • Url you want to execute: http://www.example.com/wp-admin/admin-cron.php?&action=akeebabackup_check&key=ak33b4s3cRet (under Wordpress) or http://www.example.com/index.php?&view=check&key=ak33b4s3cRet

  • Login and Password: Leave them blank

  • Execution time (the grid below the other settings): Select when you want your CRON job to run

Now click on Submit and you're all set up!

A PHP alternative to wget

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 check.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

// ====================== DO NOT MODIFY BELOW THIS LINE ======================
$curl_handle=curl_init();
// WordPress: replace index.php?view-check with wp-admin/admin-cron.php?&action=akeebabackup_check
curl_setopt($curl_handle,CURLOPT_URL,SITEURL.'/index.php?view=check&key='.SECRETKEY);
curl_setopt($curl_handle,CURLOPT_FOLLOWLOCATION,TRUE);
curl_setopt($curl_handle,CURLOPT_RETURNTRANSFER,1);
$buffer = curl_exec($curl_handle);
curl_close($curl_handle);
if (empty($buffer))
    echo "Sorry, the failed backup check didn't work.";
else
    echo $buffer;
?>

Where www.yoursite.com and YourSecretKey should be set up as discussed in the previous section.

[Warning]Warning

The ampersands above should be written as a single ampersand, not as an HTML entity (&amp;). 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 /home/USER/backups/check.php

Where /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 "/usr/local/bin/php /home/USER/backups/check.php".

Thank you DrChalta for this wonderful tip!

Using the front-end backup in SiteGround and other hosts using cURL instead of wget

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 -v "<url>"

as your command.

Replace <url> with your failed backup check URL.