Support

Akeeba Backup for WordPress

#21737 CLI/cron mode using "akeeba-backup" in place of [SITENAME]

Posted in ‘Akeeba Backup for WordPress’
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

WordPress version
n/a
PHP version
n/a
Akeeba Backup version
n/a

Latest post by heidi4web on Monday, 22 December 2014 08:01 CST

heidi4web
We ran across an interesting issue when performing the following:

1) Configure a backup to upload to Amazon S3 (new or legacy version) and use the [SITENAME] parameter in the path (not the bucket).
2) Run the backup from within wordpress and it will upload to the correct location (bucket/[SITENAME]/).
3) Setup a cron job to run (such as "/usr/bin/php5-cli /public_html/wp-content/plugins/akeebabackupwp/app/cli/backup.php --profile=2") and it will upload to a different path, substituting "akeeba-backup" in place of the [SITENAME] parameter (bucket/akeeba-backup/).

Using the [SITENAME] variable was useful for us since we can import an akeeba backup profile and not have to change that particular setting. Is that something that is not supported in the Wordpress version of the plugin?

I attached a log of the cli backup as well as a backup run from the back end.

Thank you!

dlb
If I understand you correctly, the easiest way to do that would be to set up a separate profile using akeeba-backup as the path instead of [SITENAME] and call the new profile from the CRON job.


Dale L. Brackin
Support Specialist


us.gifEnglish: native


Please keep in mind my timezone and cultural differences when reading my replies. Thank you!


????
My time zone is EST (UTC -5) (click here to see my current time in Philadelphia, PA)

heidi4web
We were actually just testing the cron job to setup a daily backup, and ran it from both the backend and the command line and were surprised to find it uploading to two different locations.

We'd like the cron job execution of the backup profile and the wordpress backend execution of the backup to both go to the same location, and it's been our experience that with the Joomla version of the component that is what happens when the [SITENAME] variable is used in the path. So if the name of the site is "website" and the upload path in Amazon S3 is /daily-backup/[SITENAME]/[DATE]/, it would upload to /daily-backup/website/2014121914/backup.jpa

This is what it does when run through the back end of Wordpress, but the same profile run through the command line or cron job uploads to /daily-backup/akeeba-backup/2014121914/backup.jpa, which wasn't the expected behavior.

It looks like it's using the plugin name or something besides the website name in place of [SITENAME] when the backup job is run from the command line, as opposed to the actual website name when run from the backend.

This can be very easily fixed by writing the website name in the path in the backup profile, but it wasn't the behavior we were expecting to see when using the [SITENAME] variable. At least it didn't replicate the behavior from the Joomla component.

Thanks!

dlb
My apologies, I did not properly understand your question. You are correct, that is not the expected behavior. I'll flag this for Nicholas' attention, but it is pretty late in his corner of the world, I doubt that he will be back today.


Dale L. Brackin
Support Specialist


us.gifEnglish: native


Please keep in mind my timezone and cultural differences when reading my replies. Thank you!


????
My time zone is EST (UTC -5) (click here to see my current time in Philadelphia, PA)

nicholas
Akeeba Staff
Manager
Hello Heidi,

This is by design. Retrieving the name of the WordPress site is not possible through a CLI application. Unlike Joomla!, WordPress doesn't have a CLI application program interface. Since we cannot leave it empty, we decided to always return "Akeeba Backup". You can see that code in wp-content/plugins/akeebabackupwp/helpers/Platform/Wordpress/Platform.php lines 279-290 (method get_site_name). If the get_bloginfo WordPress core function exists we use it, otherwise we have to revert to the generic "Akeeba Backup" name,

That said, you should never use [SITENAME] for naming backups or backup directories. This variable was only meant to be used in notification emails. It's not unique, it can change over time and it can even contain invalid characters for path naming leading to backup failure (we do try to filter out invalid characters but no filter is perfect). Instead of it you should be using the [HOST] variable which returns the domain name of your site.

Alternatively, you can hard-code the site name in the directory name you've set up in your archive post-processing configuration. This is less flexible, but considering how you use it (as a unique identifier for the site in your S3 bucket) this is what you should actually be doing.

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!

heidi4web
Hi Nicholas,

Thank you for the quick reply. Using the [HOST] variable sounds like a good solution: we'll go ahead and make that change. Thanks!

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!