Support

Akeeba Backup for Joomla!

#35753 backup pro using CLI script sends mail

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 davidascher on Monday, 13 September 2021 13:58 CDT

davidascher

From the documentation it appears (to me anyway) that the email sent after the end of a backup informing the specified recipients that the backup has completed successfully or with an error should be sent only at the end of a backup using the Front End url. The email texts and the recipient lists are configured in the "Front-end Backup" tab in Options.  I am using the cli script akeeba-backup.cli invoked from a cron job on my local host machine. At the end of the backup, the success (or failure) emails specified in the "Front-end Backup" 

Is this the intended behavior? if so, the documentation could be a bit clearer about that, and it would be clearer if the configuration of the email texts and recipients could be moved to a separate tab altogether - if not moved to somewhere in the configuration of profiles so each profile could be configured differently if necessary.

(This is probably not a big problem for most people, but if they, like I, take over the maintenance of a site previously configured by somebody else, tracking down where these emails get defined can take considerable time and effort. 

nicholas
Akeeba Staff
Manager

Akeeba Backup 8 does NOT send email for CLI backups. However, your server's CRON daemon will send you an email with the console output of the CLI script. Is it possible that this is the email you are talking about?

If so, remember to add 1>/dev/null 2>/dev/null at the end of the CRON command line to suppress output. Without any output the CRON server should send no email to you.

Personally, I prefer to receive this email to know that the backups did run. I have a rule on my mail client which will put these emails on a separate folder so they don't clog up my main inbox.

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!

davidascher

I receive both the cron output AND the message from the CLI script. I am executing the backup script using the cron service on SiteGround. 

BTW - it would be good to have some way in the CLI script to indicate which PROFILE was being used for the backup. I tried inserting  "[PROFILE]" in the messages configured (under Front-end backup tab) hoping that there was a corresponding variable defined - I couldn't find any list of the variables in the docs - but apparently PROFILE is not one of the variables available. Could it be? (assuming that you won't 'fix'' the sending of those emails sent when using the local cron service.)

I'd be happy to send you samples of those emails I am receiving (that I thought should only be sent when using the Front-end backup)

nicholas
Akeeba Staff
Manager

The output of the CRON script already includes the profile number.

The CRON script does NOT send an email. I am actually using it on all of my sites, not to mention hundreds of other people doing the same.

Since you say that you do not see the profile number and you do receive an email I understand that you are NOT using the CLI script for CRON jobs (akeeba-backup.php). You are most likely using the alternate script, akeeba-altbackup.php, which goes through the legacy front-end backup feature — the same think you would be using if you were to use, say, WebCRON. In this case you indeed will not see the backup profile in the output and you will receive an email since the backup is actually taken using the legacy front-end backup feature. The CLI script merely accesses the front-end backup feature.

Do note that the alternate CLI script is only used when the only PHP CLI binary available on your server is an older PHP version not supported by Akeeba Backup or if it's misconfigured and does not include required features for the backup such as the mysqli / PDO mysql database driver (used to back up the database), the curl extension for PHP (used to send backups to remote storage), the PHP OpenSSL encryption (used to parse encrypted configuration options) etc. In short, this is not the normal or desired way to automate backups. It's one of the fallbacks we provide just because we expect our software to run on many server environments, including some borderline unusable servers.

Please change your CRON job to use akeeba-backup.php instead of akeeba-altbackup.php. You do not need the alternate script on SiteGround, it supports regular CLI mode CRON scripts just fine.

 

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!

davidascher

"The CRON script does NOT send an email. I am actually using it on all of my sites, not to mention hundreds of other people doing the same."

I understand that. I did check off that I am using SiteGround hosting. They have an option to have the output of the cron job mailed. I am using that to receive that email. I am not using the alternate akeeba CLI backup script. I am using the 'normal' akeeba-backup.php in the cli directory. 

The email I get from the CLI script (xxxx to obscure sensitive data) has the subject line:

Completed Backup: xxxxxxx.org

the body is :

Completed Backup:  xxxxxxx.org

Your site has been successfully backed up.

Backup taken 20210903

File Details:          site-xxxxxxx.org-20210903-010101-TOgc4CKUsFVfzTeK.jpa

The email that I get from the cron job has the subject:

Cron <xxxxxxxxx> /usr/bin/php www/xxxxxxx.org/public_html/cli/akeeba-backup.php --profile=2

and starts with:

Akeeba Backup CLI 8.0.10 (2021-08-23)

Copyright (c) 2006-2021 Akeeba Ltd / 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.

-------------------------------------------------------------------------------

You are using Joomla! 3.9.28 on PHP 7.4.23 (cli)

 

Does that make things clearer?

nicholas
Akeeba Staff
Manager

Actually, as far as I can see, Akeeba Backup has always been sending emails for CLI and remote JSON API backups going back to 2011 (I can't check before that; the version control history stops there as there was no proper tooling for importing the old Subversion repository's history to Git back then). Apparently very few people use this feature. I haven't touched it in any meaningful way since 2014 which explains why I misremembered how it works.

So, it's normal to send emails. You can suppress these emails by disabling emails on backup end altogether in the component options. 

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!

davidascher

I have very mixed feelings about finding this obscure problem. I had thought you had superhuman abilities when it came to how all this stuff works - my faith is shaken. But just a little bit.

I don't suppose there is any chance of somehow getting the profile id to show up in the emails sent by the CLI scripts (by adding a parameter if one does not already 'secretly' exist?). That way I could drop the sending of the email by the cron job and just use the much shorter one sent by the CLI script. If the backup fails I could then just go have a look at the log on the site.

I understand this is all pretty small stuff in the scheme of things and that you are probably wrestling with finding and fixing problems caused by Joomla 4 which are much more complicated to analyze and fix. But if, along the way, in a future update, you could consider a) correcting the documentation about the CLI scripts and b) adding a parameter for outputting the profile id in the scripts, I would be very grateful.

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!