Support

Akeeba Backup for Joomla!

#9175 CLI Backup failure since upgrade to 3.3.6

Posted in ‘Akeeba Backup for Joomla! 4 & 5’
This is a public ticket

Everybody will be able to see its contents. Do not include usernames, passwords or any other sensitive information.

Environment Information

Joomla! version
n/a
PHP version
n/a
Akeeba Backup version
n/a

Latest post by nicholas on Tuesday, 22 November 2011 11:26 CST

user39177
Mandatory information about my setup:

Have I read the related troubleshooter articles above before posting (which pages?)? Yes
Have I searched the forum before posting? Yes
Have I read the documentation before posting (which pages?)? Yes
Joomla! version: 1.7.3
Akeeba Backup version: Akeeba Backup Professional 3.3.7 (2011-11-19)

Description of my issue:

We run an automated CLI backup script, within a chrooted environment, which was working fine until the upgrade to 3.3.6. Here is the script snippet:
datestamp=$(date +'%Y%m%d%H%M')
/usr/local/php/bin/php /www/somesite.co.uk/www/administrator/components/com_akeeba/backup.php \
-override "akeeba.basic.output_directory=/www/somesite.co.uk/backups" \
-override "akeeba.basic.temporary_directory=/www/somesite.co.uk/tmp" \
-override "akeeba.basic.archive_name=${datestamp}"
It is run from a cronjob but when I execute from the command line one now sees:

Akeeba Backup CLI 3.3.7 (2011-11-19)
Copyright (C) 2010-2011 Nicholas K. Dionysopoulos
-------------------------------------------------------------------------------
Akeeba Backup is Free Software, distributed under the terms of the GNU General
Public License version 3 or, at your option, any later version.
This program comes with ABSOLUTELY NO WARRANTY as per sections 15 & 16 of the
license. See http://www.gnu.org/licenses/gpl-3.0.html for details.
-------------------------------------------------------------------------------

Starting a new backup with the following parameters:
Profile ID  1
Description "Command-line backup"

Configuration variables overriden in the command line:
akeeba.basic.output_directory, akeeba.basic.temporary_directory, akeeba.basic.archive_name

Current memory usage: 743.74 Kb

Unsetting time limit restrictions.

Site paths determined by this script:
JPATH_BASE : /www/somesite.co.uk/www/administrator
JPATH_COMPONENT_ADMINISTRATOR : /www/somesite.co.uk/www/administrator/components/com_akeeba

Last Tick   : 2011-11-22 08:13:51 GMT+0000 (UTC)
Domain      : init
Step        : 
Substep     : 
Memory used : 4.1 Mb
Warnings    : no warnings issued (good)

An error has occurred:
Could not open /www/somesite.co.ukbackups/20111122081349.j01 for writing. Check permissions and open_basedir restrictions.

Peak memory usage: 4.17 Mb
It looks like the output path for the stage files is not being built correctly. If I check the Output Path directory in the GUI it says "[ROOTPARENT]backups" and please note that I browsed to that path and selected it.

nicholas
Akeeba Staff
Manager
Try the following (also note how the date stamp you created is unnecessary, since this is supported out of the box):

/usr/local/php/bin/php /www/somesite.co.uk/www/administrator/components/com_akeeba/backup.php \
-override "akeeba.basic.output_directory=/www/somesite.co.uk/backups/" \
-override "akeeba.basic.archive_name=[DATE][TIME]"

The change is that I appended a slash to the output directory override (it's required) and that I removed the tmp directory override (the output directory is also used as a tmp directory since Akeeba Backup 3.3.6).

Also, given that there was no change in the backup location code between 3.3.5 and 3.3.7 and that command-line backups on 3.3.5 didn't work at all, I think that the last version which was working for you must have been 3.3.4 and not 3.3.6.

Nicholas K. Dionysopoulos

Lead Developer and Director

🇬🇷Greek: native 🇬🇧English: excellent 🇫🇷French: basic • 🕐 My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!

user39177
Code now reads as
        /usr/local/php/bin/php /www/somesite.co.uk/www/administrator/components/com_akeeba/backup.php \
                -override "akeeba.basic.output_directory=/www/somesite.co.uk/backups/" \
                -override "akeeba.basic.archive_name=[DATE][TIME]"
but still fails with
An error has occurred:
Could not open /www/somesite.co.ukbackups/site-somesite.co.uk-20111122-121445.jpa for writing. Check permissions and open_basedir restrictions.

nicholas
Akeeba Staff
Manager
I want you to pay very close attention to the error message and tell me if there is a forward slash between somesite.co.uk and backups in the error message. If there's not, please triple-check your command line and make sure that it reads "akeeba.basic.output_directory=/www/somesite.co.uk/backups/", with the forward slash between somesite.co.uk and backups.

If the slash is already there and you accidentally skipped it when you posted your request, then I was trying to solve the wrong problem all along (which does make sense, as the two problems in your two posts can't be happening when using the same code, it would be impossible). In that case, you just have to ensure that the /www/somesite.co.uk/backups/ directory is writable by the user under which the CRON job runs. If unsure, try giving it 0777 permissions and if that works you at least know where the problem is.

Nicholas K. Dionysopoulos

Lead Developer and Director

🇬🇷Greek: native 🇬🇧English: excellent 🇫🇷French: basic • 🕐 My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!

user39177
If I echo the command instead of executing it one sees
/usr/local/php/bin/php /www/somesite.co.uk/www/administrator/components/com_akeeba/backup.php -override akeeba.basic.output_directory=/www/somesite.co.uk/backups/ -override akeeba.basic.archive_name=[DATE][TIME]
You can clearly see that on the echo line the slashes are present. Directory permissions are not an issue as the cron is running under root; as I am backing up multiple sites all chrooted and with their own permissions. If one looks in the Administrator interface the output path appears to reflect the error in that the forward slash is missing; though I selected it using the Browse button. If that is the case then it would also suggest that the CLI override is not being honoured.

nicholas
Akeeba Staff
Manager
Yes, the overrides are not taken into account, but that's expected. Look at the command line I gave you. Do you see what's missing? The double quotes surrounding the key=value pair after the -override switch. I would also recommend updating to Akeeba Backup 3.3.7 as this is what I'm testing locally when replying to you and I know that the backup.php file in this release does work and it does accept overrides. If it doesn't work, make sure that during update you get no errors about files which can not be moved.

As a side note, in the back-end, the slash is included in ROOTPARENT and that's why it's skipped. But this is completely irrelevant.

Nicholas K. Dionysopoulos

Lead Developer and Director

🇬🇷Greek: native 🇬🇧English: excellent 🇫🇷French: basic • 🕐 My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!

user39177
Hi, the double quotes are there it is just that due to echoing the CLI command it interpreted them; if I escape them out on the echo they show fine. According to the script I am running 3.3.7 and if I check version.php it looks okay
define('AKEEBA_PRO', '1');
define('AKEEBA_VERSION', '3.3.7');
define('AKEEBA_DATE', '2011-11-19');
If I specify no override options it still fails with Could not open /www/somesite.co.ukbackups/20111122163746.j01 for writing.

Hmm, if I go into the Admin GUI and add that missing slash from output path and then run from the CLI it does back up. So some how that '/' is not being added.

nicholas
Akeeba Staff
Manager
I can't understand what's wrong with this command line :s When I try the same think on my own test server (Linux 3.0, PHP 5.3.8, Joomla! 1.5.25, Akeeba Backup Pro 3.3.7) it works fine and accepts the override.

The only thing I can think of is that you are using PHP CGI instead of PHP CLI. The former will not allow command line parameters to work reliably. Please run the following command
/usr/local/php/bin/php -v
and paste the result here. It should begin with something like "PHP 5.3.8 with Suhosin-Patch (cli)". What's important is what's in the parentheses. It should read cli and not cgi.

Nicholas K. Dionysopoulos

Lead Developer and Director

🇬🇷Greek: native 🇬🇧English: excellent 🇫🇷French: basic • 🕐 My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!

user39177
PHP 5.3.8 (cli) (built: Aug 26 2011 21:32:20) 
Copyright (c) 1997-2011 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2011 Zend Technologies
    with the ionCube PHP Loader v4.0.4, Copyright (c) 2002-2010, by ionCube Ltd.
    with Suhosin v0.9.32.1, Copyright (c) 2007-2010, by SektionEins GmbH

nicholas
Akeeba Staff
Manager
OK, that's crazy. We're running the same software on the same setup and have different results. This can't be :s The only plausible explanation is that your last update to 3.3.7 didn't work. If it's not a huge trouble, can you try uninstalling and reinstalling Akeeba Backup Professional 3.3.7? In order not to lose your settings, you have to do this:
- Keep a copy of your jos_ak_stats and jos_ak_profiles tables (e.g. using phpMyAdmin)
- If you have backups in the default backup directory, please keep a copy of them.
- Uninstall Akeeba Backup
- Install Akeeba Backup Professional 3.3.7
- Restore the jos_ak_stats and jos_ak_profiles tables
- Retry a command-line backup
Does it accept the overrides?

Nicholas K. Dionysopoulos

Lead Developer and Director

🇬🇷Greek: native 🇬🇧English: excellent 🇫🇷French: basic • 🕐 My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!

Support Information

Working hours: We are open Monday to Friday, 9am to 7pm Cyprus timezone (EET / EEST). Support is provided by the same developers writing the software, all of which live in Europe. You can still file tickets outside of our working hours, but we cannot respond to them until we're back at the office.

Support policy: We would like to kindly inform you that when using our support you have already agreed to the Support Policy which is part of our Terms of Service. Thank you for your understanding and for helping us help you!