Support

Akeeba Backup for Joomla!

#8999 advanced cron questions

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 Monday, 29 August 2011 03:49 CDT

SFA
Mandatory information about my setup:

Have I read the related troubleshooter articles above before posting (which pages?)? Those that turned up in my search
Have I searched the forum before posting? Yes
Have I read the documentation before posting (which pages?)? Yes. All of "Akeeba Backup User's Guide" with focus on the "Automating your backup" for this question
Joomla! version: 1.5.23
PHP version: 5.2.9
MySQL version: 5.0.92-community
Host: hostgator
Akeeba Backup version: Professional

Description of my issue:
I'm using the command line backup via a cron: /usr/local/bin/php /home/xxxxxx/www/administrator/components/com_akeeba/backup.php -profile=1
2 questions:
1) is there an easy way to only have the "echo' occur in the event of a warning? Maybe an -override parameter I can set? The cpanel cron emails me the output of the "echo" and I'd rather not receive those emails unless there's an issue.

2) is there a way to invoke the "email on backup completion" when using the command line backup (the cron command I mentioned above)? I know this seems opposite of my #1 question but these emails would be for my customer, the site owner and the information I currently receive is too low level for what my customer would want to see.

I'm an experienced php user and could tweak backup.php but prefer not to for multiple reasons.

nicholas
Akeeba Staff
Manager
Hi!

1. Akeeba Backup Professional, ever since version 3.2.6, already has this feature built in and always enabled. I assume that you have a very old version of Akeeba Backup Professional. Please upgrade.

2. If you enable this feature, an email will always be sent out if your take a backup with any other method than the back-end backup. Again, based on your description, I suspect that you have a very old version of Akeeba Backup Professional.

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!

SFA
Nicholas - thanks for the response. I'm currently using Akeeba Backup Professional 3.3.3 (2011-08-11) - I should have included that with my original post.

1. So you're saying that the backup.php script only ever echo's output in the event of an error or warning? It's very possible I'm confused but a review of the script shows that backup.php lines 267-284, 378-387,and 393-400 will always echo output (which seems to correlate to what I'm seeing in my email). As part of my cron command I could set '-mailto=""' and avoid the email but, it'd be nice to see warnings/errors. Another oddity is according to backup.php I should see either "An error has occurred..." or "Backup job finished successfully..." at the end but it doesn't show. I can forward email if desired. A look at my log

2. Okay. Does "Enable front-end and remote backup" have to be enabled for this email to be sent? I have "Email on backup completion" set to yes.

nicholas
Akeeba Staff
Manager
Hi!

In the backup.php file bundled with Akeeba Backup Professional 3.3.3 the warnings are displayed thanks to lines 368:376. Moreover, should any warnings be registered, lines 402:410 will print a big warning message at the end of the process, making sure you don't miss the messages. Also, the post-backup email is sent due to lines 167:246 of administrator/components/com_akeeba/akeeba/core/domain/finalization.php

However, based on your description, the backup never runs to its completion. It halts before it's over, that is why you do not get the finalization message and the email. I'd recommend zipping and attaching your backup log file (from the "Command-line" origina) in your next message so that I can take a look and tell you why the backup failed.

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!

SFA
Nicholas - thanks for the help. Attached is my log file. In my review, nothing jumped out at me. I did notice that in the "backend" log file (which I did not attach) I'm getting:

[110814 13:11:35] Kettenrad :: Attempting to load from database (backend)
[110814 13:11:35] -- Stored Akeeba Factory (backend) not found - hard reset

Which I was also trying to troubleshoot from other posts in the forum.

nicholas
Akeeba Staff
Manager
Thank you for the log! I think I understand what is going on. Even thought the backup-taking part of the process is complete, the final housekeeping (quota application, emailing administrators and showing you the backup completion message) never runs. It's as if the server just crashes when trying to apply the quotas.

If you have a PHP error log, you can certainly take a look and tell me what is the error logged there. Otherwise, I can speculate -based on experience- that the structure of Akeeba Backup's database table was not applied correctly durign installation/update. In such a case, please give me the results of the SHOW CREATE jos_ak_stats command so that I can advise further.

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!

SFA
The only 3 lines in my php error-log are:
[14-Aug-2011 12:49:08] PHP Warning: Module 'zip' already loaded in Unknown on line 0
[14-Aug-2011 13:27:52] PHP Warning: Module 'zip' already loaded in Unknown on line 0
[14-Aug-2011 13:27:57] PHP Warning: Module 'zip' already loaded in Unknown on line 0

results of the SHOW CREATE TABLE jos_ak_stats:

CREATE TABLE `jos_ak_stats` (
`id` bigint(20) unsigned NOT NULL auto_increment,
`description` varchar(255) NOT NULL,
`comment` longtext,
`backupstart` timestamp NOT NULL default '0000-00-00 00:00:00',
`backupend` timestamp NOT NULL default '0000-00-00 00:00:00',
`status` enum('run','fail','complete') NOT NULL default 'run',
`origin` varchar(30) NOT NULL default 'backend',
`type` varchar(30) NOT NULL default 'full',
`profile_id` bigint(20) NOT NULL default '1',
`archivename` longtext,
`absolute_path` longtext,
`multipart` int(11) NOT NULL default '0',
`tag` varchar(255) default NULL,
`filesexist` tinyint(3) NOT NULL default '1',
`remote_filename` varchar(1000) default NULL,
`total_size` bigint(20) NOT NULL default '0',
PRIMARY KEY (`id`),
KEY `idx_fullstatus` (`filesexist`,`status`),
KEY `idx_stale` (`status`,`origin`)
) ENGINE=MyISAM AUTO_INCREMENT=5 DEFAULT CHARSET=utf8

nicholas
Akeeba Staff
Manager
Hm, the table structure is correct and there are no PHP errors. The only other thing I can think of is the host automatically cancelling the CRON job due to excessive CPU usage or another time constraint. You can check for that by excluding some large tables and directories from the backup (so that it runs faster) and see if the process completes. If it still doesn't, I am afraid I have run out of ideas and you'll have to ask your host for any insight they might be willing to share.

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!

SFA
Okay - I'll remove the dump of the phpbb_search_wordmatch table (takes 6 minutes, 1.7M rows) and see if that helps. I'll just wait and let it do it's nightly run and check back tomorrow. Thanks for the help today.

SFA
One other note regarding cpu resources on my host. Within the "Resource Alerts" in my Parallels Power Panel I have the following alerts (note my backup runs at 4AM Central Time):

Aug 14, 2011 04:00:31 AM: Resource counter_cpu_share_used red alert on environment sto.stonefabricatorsalliance.com current value: 96 soft limit: 85 hard limit: 95 | Red Zone

Aug 14, 2011 04:12:31 AM: Resource counter_cpu_share_used green alert on environment sto.stonefabricatorsalliance.com current value: 28 soft limit: 85 hard limit: 95 | Green Zone

Aug 14, 2011 04:13:31 AM: Resource counter_disk_share_used yellow alert on environment sto.stonefabricatorsalliance.com current value: 76 soft limit: 85 hard limit: 95 | Yellow Zone

I might have thought that at 04:00:31 when it was at 96, it would have crashed (since upper limit is at 95). And comparing the last entry in the Akeeba log at 04:13:56 to the 04:13:31 entry above where cpu was at 76, leads me to believe it's possibly a time issue verses a CPU resource issue??? Completely speculating here.

nicholas
Akeeba Staff
Manager
Yes, it looks like it. I am speculating that your server tries to figure out which is the CPU-hungry process and kill it when the CPU utilization goes right into the red zone. This means that it will kill Akeeba Backup's CRON script.

There is a workaround, but it will make the backup dead slow. You can set the following configuration parameters in Akeeba Backup's Configuration page for the backup profile you're using with CRON:
- Minimum execution time: 5 seconds
- Maximum execution time: 3 seconds (yes, lower than the minimum!)
- Runtime bias: 65%
This should lower the CPU usage to almost half as much as it is now, with the major drawback of prolonging the backup to over twice as long as it is now.

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!

SFA
I'll give that a try for tomorrow night's backup. Last night's backup ended with same results as before. Backup only took 4 minutes but Akeeba log ended with:

[110815 04:04:04] Post-processing has finished for all files
[110815 04:04:04]

Also saw this in my resource alerts.

Aug 15, 2011 04:00:32 AM: Resource counter_cpu_share_used red alert on environment sto.stonefabricatorsalliance.com current value: 97 soft limit: 85 hard limit: 95 | Red zone

Aug 15, 2011 04:02:31 AM: Resource counter_cpu_share_used green alert on environment sto.stonefabricatorsalliance.com current value: 27 soft limit: 85 hard limit: 95 | Green zone

Nothing in my phpBB error logs. I should check my site error log settings to make sure errors are being logged is being done as well. At least the backup is completing.

nicholas
Akeeba Staff
Manager
Did you by any chance had Akeeba Backup 3.3.0 or 3.3.1 installed on that site before upgrading to 3.3.3? The description of this problem strongly reminds me of a problem with PHP 5.2 hosts and early 3.3.x versions of Akeeba Backup. Normally, on a properly upgraded site with 3.3.3, this doesn't happen. Would you mind trying to install 3.3.3 again (without uninstalling your current version) and tell me if there are any error messages reported?

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!

SFA
Yes! I had Akeeba Backup 3.3.1 installed before Pro 3.3.3. Originally, I uninstalled 3.3.1, and then installed Pro 3.3.3 by uploading the package file within my Joomla Extension Manager Install area.

I just re-installed Pro 3.3.3 again without uninstalling current version (re-downloaded package from site just in case). Used the "upload package file" within Joomla. No error messages that I can tell. Any other suggestions? I'd love to fix this even if it means a clean install and resetting my current configuration.

As status, backups are still completing and it still crashes at the "Post-processing has finished for all files" even after making the config changes you suggested above. Oddly the amount of time to do backup remains the same and I'm still getting similar "resource alerts" during backup so don't know if I was supposed to do something in addition to changing values in the config area.

nicholas
Akeeba Staff
Manager
Hm, let's try calling in the big guns. Try completely uninstalling Akeeba Backup, then reinstall 3.3.3 and configure it. I suppose that this should fix this issue. If not, please let me know.

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!

SFA
Still no luck. I even tried changing the cron line from "/usr/local/bin/php" to another php file "/usr/bin/php" and there's also a php-cli in the same "/usr/bin/" directory which I tried. I sure wish some error would get logged that could give us some clue. The fact that my error_log files only ever contain 3 or 4 lines and it's always "PHP Warning: Module 'zip' already loaded in Unknown on line 0" makes me wonder if I'm looking at the correct error log or else error logging isn't working like I think it is. My php config shows that error_log = "error_log" and error_reporting = "E_ALL & ~E_NOTICE" so I think it should be telling me something more than it is.

nicholas
Akeeba Staff
Manager
I am wondering, does the backup work properly from the back-end of your site? I mean, does it run to its completion, without an error?

If it does, there is a PHP version mismatch between what runs on the web and what runs in the CLI. In this case, you have to ask your host which is the correct PHP binary.

However, if the backup doesn't run to its completion even from the back-end, please send me a Personal Message (I am user "nicholas") with login details to your site so that I can take a look myself and figure out what the problem is.

Thank you in advance for your feedback!

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!

SFA
I tried a back-end backup and I got the following:
AJAX Loading Error
HTTP Status: 500 (Internal Server Error)
Internal status: error
XHR ReadyState: 4
Raw server response: (this was blank)

Thanks so much for offering to take a look. I'll PM you.

nicholas
Akeeba Staff
Manager
Hi!

Thank you for your PM, I now know what is going on. You are using the maximum age quota settings, but they require PHP 5.3 or later to work properly. This is due to the fact that the required date math features are very poorly implemented in PHP 5.2 and earlier, so I had to use PHP 5.3-only syntax. You should disable that feature and your backup jobs will complete successfully.

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!

SFA
Sure enough, that was it. Thanks.

I think I'll alter the script though to store the echo information in a variable and only echo the information if there's an error, that way the cron won't send me an email every day, only if there's a problem.

nicholas
Akeeba Staff
Manager
Thank you for your feedback! I am glad it works now.

I have an idea: how about me adding a --quiet switch to the script which supreses verbose output and only displays warningand error messages? Drawing further on that idea, I can modify the exit code of the script to be 0 on successful run, 1 if there are warnings and 2 if there is an error, so that you can write a wrapper shell script to automate actions based on the Backuo status. What do you think? Would that be a good idea?

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!

SFA
Yes! Both of those are great ideas. Wasn't trying to add to your (I'm sure busy) workload but that's nice. Regarding the shell script and the exit code returning 1 or 2, would there be information about the warning/error for the shell script to work with or would it just be a "it was 1 (or 2), uh oh, you'd better go check your log"? Regardless, need any help with testing, just let me know.

One other minor suggestion that might prevent people from having this same problem with the Max Quota, on the configuration page add a note that says something like "(requires php 5.3 or later)" either after the text "Enable maximum backup age quotas" or the "mouse over" text . I could understand if you preferred to leave those notes out of the public area but the max age quota is a pretty slick feature that many might enable.

nicholas
Akeeba Staff
Manager
Good news! After digging around some more, I figured out that PHP 5.2 has a similar -albeit odd-named- date handling mechanism so I was able to update the code to run on PHP 5.2.

Moreover, I have modified the backup.php script like I said. Appending --quiet will turn off all output except warnings and errors. The exit code will be 0 if there are no warnings, 1 if there are warnings and 2 if there is an error. Having a different exit code per error message is not possible due to the way error propagation is currently implemented in the engine. Besides, there is no point. If the backup fails, you need a human to take a look and figure out why. If troubleshooting automation was possible, this forum would not exist and I'd be a very happy man with lots of free time ;)

All those changes are implemented in the latest developer's release (svn845). Note: this dev release is being uploaded right now; give it a minute or two to be listed in the download page.

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!

SFA
That's great Nicholas. I'll give this a try this week. Awesome.

nicholas
Akeeba Staff
Manager
You're welcome! Thank you in advance for your feedback :)

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!

SFA
Nicholas - just testing out the "-quite" mode. Received this in an email back from my Cron "*** ERROR: JFTP::login: Unable to login"

SFA
I should note that the backup seemed to complete correctly and the log ended in:

[110828 13:19:29] ====== Starting Step number 51 ======
[110828 13:19:29] Kettenrad :: BREAKING STEP BEFORE SWITCHING DOMAIN
[110828 13:19:29] Kettenrad :: No more domains to process
[110828 13:19:29] *** Engine steps batching: Break flag detected.
[110828 13:19:29] *** Batching of engine steps finished. I will now return control to the caller.
[110828 13:19:29] No need to sleep; execution time: 1.2731552124 msec; min. exec. time: 0 msec
[110828 13:19:29]
[110828 13:19:29] Kettenrad :: Just finished
[110828 13:19:29] *** Batching of engine steps finished. I will now return control to the caller.
[110828 13:19:29] No need to sleep; execution time: 0.874996185303 msec; min. exec. time: 0 msec
[110828 13:19:29]
[110828 13:19:29]

Looks like you're going on vacation. Obviously there's no priority on this. Enjoy your vacation.

nicholas
Akeeba Staff
Manager
My vacation starts tomorrow :)

The problem is not in the backup portion (that worked), it's in the post-processing portion of the whole process. Apparently, you seem to have used "Upload to remote FTP server" but the either the login credentials or the initial directory of the remote FTP server is wrong. Try going to the Configuration page in the back-end and modifying the connection information there. You may want to use the "Test FTP Connection" button to make sure that everything is configured correctly and Akeeba Backup can connect to your remote FTP server.

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!

SFA
Hm - looking at the configuration, I have "Data processing engine" set to "No post-processing". I don't think I've ever configured to use the "Upload to remote FTP server" (at least not that I remember). Ran it a second time and no issues this time so I don't know what happened. Regardless, the '-quite' part is working. I'll test the exit code here in a bit.

nicholas
Akeeba Staff
Manager
Do you have the FTP setting enabled in your Global Configuration? If yes, it's possible that a plugin, completely unrelated to Akeeba Backup, tried to write something, it failed and caused the error to appear. Since this doesn't happen again, I'd say you just had some unfortunate timing there.

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!