Support

Akeeba Backup for Joomla!

#9275 Email Notification of failed backups?

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, 10 January 2012 03:08 CST

BenAllan
Hi guys,

Is it possible to get email notifications when a Front End backup fails??

At the moment I'm getting the cron emails when they are successful, but I have so many sites running its hard to notice if one of the emails doesn't roll in, it would be much easier to get a "FAILED" email!

Thanks!

nicholas
Akeeba Staff
Manager
A failed backup means that the backup process crashed for some reason with an error. If it didn't crash, the backup would complete. When it crashes, the script stops executing. How would a script which is no longer executing due to an error/crash send you an email?

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!

BenAllan
I'm not sure Nicholas, but how does any system or application do an error report? or debug log?

Does Akeeba Backup keep an error log? Could something not be triggered if an error or "Failed" backup is registered in the system?

If I log into my administrator section and go to Akeeba Backup, and I look at "Administer Backup Files" I can see a "Status" column. Surely it can't be impossible to write something that says "When a backup has a status of "Failed" email the administrator".

I'm not a developer - I'm an end user - but even with my limited knowledge of coding I can see a logical process to follow.

nicholas
Akeeba Staff
Manager
What you are asking is a dead man to send an email that he was killed and who his killer was. The only chance of that happening would be another guy observing the scene and sending the email. the PHP script doing the backup is the dead guy. The server is the killer. Nobody else is on the crime scene. Neither the dead guy, nor the killer will send an email, ergo what you ask is impossible.

FYI, when the backup fails, the backup record is marked as "pending". When you visit Akeeba Backup's back-end Control Panel page we go through the pending backups and if it's over 3 minutes after the last step, we consider them failed. This is the earliest we know of a failed backup. I can send an email then, but I guess that's pointless.

When I say that something is impossible, it means that I have already thought of that and it can't happen. Otherwise I ask for more information about it and implement it ;)

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!

BenAllan
Hey mate,

Perhaps I'm misunderstanding something...

If the backup does not run its due course, for whatever reason, I thought that it was recorded in the system as "Failed" - I have attached an image with a screen cap of one of my sites.

If AB knows that the backup has failed, then obviously SOMETHING is being recorded against that backup attempt, and that can be used as a trigger for an email?

I've never seen a backup marked as "Pending" - only Complete, Obsolete, or Failed.

So I'm guessing that all the "Failed" backups in my screen cap are backups that were idle for 3 minutes?

If that is so, then I think that when the system marks that as "Failed" that would be the best time to send an email!

There are some sites that I don't go to for weeks at a time, and I would like to know that it is NOT backing up properly so I can fix the issue ;)

Don't get me wrong, I love your component and I love your work! I just believe that there has to be a solution to every problem. As they say, necessity is the mother of all invention! ;)

BenAllan
Sorry, forgot to attach the file!

nicholas
Akeeba Staff
Manager
Didn't I just explain to you how Akeeba Backup works? You probably didn't get it, so we're going to do a little experiment here. We'll kill a backup and do an autopsy! I hope you like CSI as much as I do ;)

Here is the experiment:
- Start a backup
- Midway through the backup cancel it by closing your browser
- DO NOT VISIT ANY OTHER AKEEBA BACKUP PAGE!!! This is very important. You'll see why.
- Wait 60 seconds (this is to make sure that the backup is dead beyond any possible recovery)
- Open phpMyAdmin
- Check the latest entry in the jos_ak_stats table (the latest entry is the one with the highest id; jos_ is to be replaced with your site's table name prefix).
- See the "status" column. Do you see what it reads? It reads "run" which is what the Administer Backup Files page reports as "Pending".
- Visit Akeeba Backup's Control Panel page by clicking on Components, Akeeba Backup.
- Reload phpMyAdmin, look again at the latest entry of the jos_ak_stats table, the status field. See what it reads? "fail" which is rendered as "Failed" in the Administer Backup Files page.

Ergo: Akeeba Backup will only mark the backup as failed when you visit the Control Panel page after a backup has failed. Why? Because when the backup fails, the PHP code which was running the backup is dead, as in no longer running. If the code is not running, how would you expect this (non-running) code to actually do anything? It starts making sense, doesn't it.

Put in another way. Let's say you have a PC (not a laptop and without a UPS). Rip the power cord off the wall. Whazam! The PC dies (fails). Can it email you to tell you that the power was cut off? Nope. When it powers up again, can it email you to tell you that the power had went off, sometime in the past? Yes. Same goes with backup. When the code fails, your server software (Apache) pulls the plug on PHP. PHP is dead. Gone. When will the Akeeba Backup code run again? During the next backup's startup OR when you visit the Akeeba Backup Control Panel page. Therefore, when is the next time Akeeba Backup can see if the last backup failed? During the next backup's startup OR when you visit the Akeeba Backup Control Panel page. Does it make any sense to email you at that time? No. This is what I said the previous time.

Before you ask, no, you can not have a plugin check for failed backups all the time. It would not only slow down your site, it could also misreport backups as failed. Why? Well, let's say that you have a BIG backup archive (let's say, 500Mb) which is being uploaded to Amazon S3 with a speed of 500Kb/second. It will take many minutes to upload it. During the upload, we can't update anything which would indicate that the backup process is not dead (it's uploading!), therefore the plugin would report the backup as failed, remove the backup archive and an otherwise PERFECT backup would be cancelled, deleted and never uploaded to S3. Bummer! Therefore, we can not create such a plugin.

I told you that I have thought it very thoroughly, didn't I? This is a constant feature request for the last 5 years :D

What can you do, then? It's the single most obvious thing :) Every day you should expect to receive an email at the very same time. If you don't, your backup didn't run, therefore it failed. This means that you can now go to your site, download the log file and figure out what's going on or, if you can't figure it out, start a new thread here and we'll help you. That's what everybody else does :)

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!

BenAllan
Haha... I'll take your word for it.

I didn't realise that the admin side of things marks it as failed when you logged in.

Thanks for the explanation anyway :)

Still a little hard to notice the 1 in 20 - 30 emails that doesn't come through, but I'll have to think of something else ;)

nicholas
Akeeba Staff
Manager
If you have a particular site which is failing, just monitor it every day for a month. You will find our when the backup fails :)

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!