Automated backups not working and not showing

Automated backups not working and not showing

by Marius S -
Number of replies: 29

Hello,

We are running Moodle 2.9.1, Debian server.

We have updated our Moodle from 2.6.x to 2.9.1 in July, 2015.

Set Site administration > Courses Backups > Automated backup setup set to run every Sunday, at 3:00 AM. Same settings as in Moodle 2.6 (which was working fine).

We run cron every 30minutes with this command which is written in root crontab:
*/30 * * * * wget -q -O /dev/null 'http://ourmoodleaddress.com/admin/cron.php'

In Site administration > Server > Scheduled tasks > Automated backups we haven't changed anything. Link to screenshot.


Problem:
Now on Moodle 2.9.1 automated backups is not working. In Site administration > Reports > Backups we see that Next backup is July 12, Sep. 6, etc. In Scheduled tasks > Automated backups it's written: Last run Wednesday, 2 September 2015, 9:58 PM

When we open http://ourmoodleaddress.com/admin/cron.php in browser we see all task beeing made but no information about automated backups. Here is last lines of /admin/cron.php in browser.

  .....
Cleaning up old question statistics cache records...done. ... used 6 dbqueries ... used 0.045630216598511 seconds Scheduled task complete: Background processing for question engine Execute scheduled task: Incoming email pickup ... started 11:39:28. Current memory use 75.6MB. Inbound Message not fully configured - exiting early. ... used 0 dbqueries ... used 0.0023539066314697 seconds Scheduled task complete: Incoming email pickup Execute scheduled task: Removes any unnecessary event monitor events ... started 11:39:38. Current memory use 75.8MB. ... used 0 dbqueries ... used 9.608268737793E-5 seconds Scheduled task complete: Removes any unnecessary event monitor events Execute scheduled task: Cleanup old sessions ... started 11:39:48. Current memory use 75.8MB. ... used 81 dbqueries ... used 0.06573486328125 seconds Scheduled task complete: Cleanup old sessions Cron script completed correctly Cron completed at 11:39:58. Memory used 75.8MB. Execution took 182.603961 seconds

Maybe you have idea what may be the problem?
Why there is no information about automated backups in cron.php file?

PS. I'm not saying that this might be Moodle update issue, maybe it may be faulty some courses
Because we have more than 2500 courses.

Thanks,
Marius.
Average of ratings: -
In reply to Marius S

Re: Automated backups not working and not showing

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

What does the status say by the backups in the report?  Do you have it set to not backup if there are no changes, etc...

Normally, you will see something in the cron but it might just be at the time of the backups.  What happens if you run the backups manually from command line - that might give you some clues...

In reply to Emma Richardson

Re: Automated backups not working and not showing

by Marius S -

Hello Emma,

Backup reports have different statuses. We have Unfinished, OK, Error statuses.
Also there is two courses with status: Automated backup pending.
Here is attached screenshot (not full, as it would be longer twice).

In the cron there is no information about automated backups.
I remember in older version there was lines that automated backup is scheduled to... No there is no information.
Also one more strange thing that if we run /admin/cron.php from browser it takes very long time to finish, like 2-3minutes. Not sure if it's because our Moodle has more than 2500 courses.

In apache error log I there is no errors.

Also in /moodledata/temp/backup there is ~80 .log files which size is 0bytes, and names are random letters,numbers. i.e.: ec655a97be30027a9f019f7053b128e6.log
Some .log files are created yesterday, some few days ago, oldest is 7 days old.


How I can run automated backup cron via command line?


Thanks,

Marius.

In reply to Marius S

Re: Automated backups not working and not showing

by Séverin Terrier -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Testers Picture of Translators

Hello,

When you see .log files with 0 size, that means corresponding courses have been well backuped, it's OK smile

You can call /moodle/admin/cli/automated_backups.php with a php command in a specific cron line in your crontab wink

Séverin

In reply to Emma Richardson

Re: Automated backups not working and not showing

by Marius S -

Also I have tryed to run automated_backups.php from command line and got this:

moodle2@moodle2:~/public_html$ /usr/bin/php-cgi admin/cli/automated_backups.php      
X-Powered-By: PHP/5.4.41-0+deb7u1
Content-type: text/html

                    Server Time: Wed, 25 Nov 2015 14:20:15 +0200


Checking automated backup status...RUNNING
Automated backups are already running. If this script is being run by cron this constitues an error. You will need to increase the time between executions within cron.
Automated cron backups completed correctly
Execution took 0.073386 seconds


In Course > Backups > Automated Backups I checked Active: Manual.

In reply to Marius S

Re: Automated backups not working and not showing

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers
Obviously something went wrong with your last backup.  The fact that you have some unfinished is probably stalling out your backup process but I still find it strange that you are not seeing any reference to backups when you run cron.  However, according to your logs, it is not scheduled to run because the next operation date is in the past so that could be why.
Turn automated backups off altogether and then reset them with different settings.  See if that changes the next automated backup date in your backup logs.  
If not, you might try to flush your mdl_backup_controllers table and your mdl_backup_courses table from your database (only do this if you are familiar with messing around with your database and make sure you back them up first.)  This should clear the error of backups still running...
That might at least get it to start trying to run...

In reply to Emma Richardson

Re: Automated backups not working and not showing

by Marius S -

Hello,

Thanks for reply.

I've tryed to turn off automated backups in course>backups and in sheduled task, ran cron.php in browser, then enabled automated backups with different week day and hour and it didn't fixed.

Also one more think. We are saving automated backups in moodledata and specific directory.
In that directory last successful backups was made in July 5th, it started 3AM (as was set in Automated backups) and finished at ~13PM. Made more than 1880 .mbz files. And it's normal that Moodle finishes backups within 10-12hours.

But then came next week July 12th, something went wrong, because first backup was made only at 7AM, and first course was with id=10, so it skipped front page (id=1), also it skipped(couldn't make backup) of more courses.
Also in July 12th Moodle did only 15 courses backups (last one at ~11PM).
then it continued on July 13th - did only 19 courses backups, July 14th - 26 backups, July 15th - 30 backups, July 16th - 24 backups, etc.

During July 12th - July 19th Moodle did only 188 backup files and last backup file was made on July 19th ~1AM, and on 3AM he started over, again from course id=10.


In reply to Emma Richardson

Re: Automated backups not working and not showing

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

See this post for the way to clear the unfinished status - https://moodle.org/mod/forum/discuss.php?d=224252#p1300281

Luckily someone posted to it and reminded me what needed to be done

In reply to Emma Richardson

Re: Automated backups not working and not showing

by Marius S -

Thanks,

So I just need to update backup/util/helper/backup_cron_helper.class.php file?

and add
set_config('backup_auto_running', '0', 'backup');
Immediately before the line
trace("Checking automated backup status",'...');


If I do this update in  backup_cron_helper.class.php file I won't need to flush mdl_backup_controllers and your mdl_backup_courses tables?


Thanks,
Marius.

In reply to Emma Richardson

Re: Automated backups not working and not showing

by Marius S -

I have tried your method but it didn't made all backups.

I have added  set_config('backup_auto_running', '0', 'backup'); to backup_cron_helper.class.php file.
I have set Automatic Backups setting to Manual.
I have ran CLI command: php-cgi admin/automated_backups.php

However it didn't finish all backups.
Here is the last lines of execution:
<......>
Backing up <span lang="en" class="multilingual">Final Project for Teacher Qualification</span><span lang="lt" class="multilingual">Mokytojo kvalifikacinis baigiamasis projektas</span>...
moodle2@moodle2:~/public_html$

So this shows that automated backup script actually didn't finished.
It stopped after ~6-7minutes. During this run Moodle did ~30 backups.


Also at some courses I got this message and these courses were not backed up:
backup_auto_failed_on_course ISK0312_RS
Exception: baseelementexisting annotation

Also I've found that actually and some courses was not backed up but CLI said that it was completed. We have a lot of courses with this error.

Here is debug info:

Status - Unfinished
10:55:54 AM - instantiating backup controller e2a6864866f615c1fda3e7ac3900555d
10:55:54 AM - setting controller status to 100
10:55:54 AM - loading controller plan
10:55:54 AM - setting controller status to 300
10:55:54 AM - applying plan defaults
10:55:54 AM - setting controller status to 400
10:55:54 AM - setting file inclusion to 1
10:55:54 AM - checking plan security
10:55:54 AM - setting controller status to 700
10:55:54 AM - saving controller to db
10:55:54 AM - calculating controller checksum bb71293c90664cda7e4f2ac0c4d81e53
10:55:54 AM - loading controller from db
10:55:54 AM - setting controller status to 700
10:55:54 AM - saving controller to db
10:55:54 AM - calculating controller checksum 38ae782b162e3398519380e92383100e
10:55:54 AM - loading controller from db
10:55:55 AM - setting controller status to 800
10:55:56 AM - backup_auto_failed_on_course EKM5005_EN
10:55:56 AM - Exception: baseelementexisting annotation
10:55:56 AM - Debug:

And here is debug for COMPLETED course backup:

Status - OK
10:52:46 AM - instantiating backup controller 431713dc8daf70cdd493e363ead9a1a2
10:52:46 AM - setting controller status to 100
10:52:46 AM - loading controller plan
10:52:47 AM - setting controller status to 300
10:52:47 AM - applying plan defaults
10:52:47 AM - setting controller status to 400
10:52:47 AM - setting file inclusion to 1
10:52:47 AM - checking plan security
10:52:47 AM - setting controller status to 700
10:52:47 AM - saving controller to db
10:52:47 AM - calculating controller checksum e821fa3fc544bb541af88d1144b83356
10:52:47 AM - loading controller from db
10:52:47 AM - setting controller status to 700
10:52:47 AM - saving controller to db
10:52:47 AM - calculating controller checksum b46009ff9560aaba843c273424d1f5b1
10:52:47 AM - loading controller from db
10:52:47 AM - setting controller status to 800
10:53:07 AM - setting controller status to 1000
10:53:07 AM - saving controller to db


I have these settings in server:
max_execution_time    300
max_input_time    180
memory_limit    512M



Do you have any idea how I can make a all courses backup?

And what is that error "Exception: baseelementexisting annotation" means?


Thanks,

M.

In reply to Marius S

Re: Automated backups not working and not showing

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers
So I am guessing that the baseelementexisting annotation is your issue.  Do you have a plugin that allows some sort of annotation?


In reply to Emma Richardson

Re: Automated backups not working and not showing

by Marius S -

Hello Emma,

We have one plugin which is stated as "standard":
Annotate PDF (assignfeedback_editpdf)

Also few plugins (we are using latest versions):
PDF submission (assignsubmission_pdf)
PDF feedback (assignfeedback_pdf)


Thanks,

M.




In reply to Marius S

Re: Automated backups not working and not showing

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

So PDF annotation is part of core now.  I am guessing that it is possible that the pdf submission plugin might be causing a conflict.  I suggest trying to disable or uninstall it and then see if the backups will run.  Just try one of the courses that is not completing manually with debugging on and see if that works.

Average of ratings: Useful (1)
In reply to Emma Richardson

Re: Automated backups not working and not showing

by Marius S -

Hello Emma,

We have tryed to disable both PDF submission (assignsubmission_pdf) and PDF feedback (assignfeedback_pdf) plugins and perform manual backup, and we still get the error:

Note. Also we have tryed to Enable these two plugins but Disable standard Annotate PDF, but error was the same. Before trying to make manual backup we have purged all cache.

Debug info:
Error code: baseelementexisting
$a contents: annotation
Stack trace:
  • line 103 of /backup/util/structure/base_nested_element.class.php: base_element_struct_exception thrown
  • line 152 of /backup/util/structure/base_optigroup.class.php: call to base_nested_element->check_and_set_used()
  • line 108 of /backup/util/structure/base_nested_element.class.php: call to base_optigroup->add_used()
  • line 173 of /backup/util/structure/base_nested_element.class.php: call to base_nested_element->check_and_set_used()
  • line 57 of /mod/assign/feedback/editpdf/backup/moodle2/backup_assignfeedback_editpdf_subplugin.class.php: call to base_nested_element->add_child()
  • line 60 of /backup/moodle2/backup_subplugin.class.php: call to backup_assignfeedback_editpdf_subplugin->define_grade_subplugin_structure()
  • line 137 of /backup/moodle2/backup_stepslib.php: call to backup_subplugin->define_subplugin_structure()
  • line 140 of /mod/assign/backup/moodle2/backup_assign_stepslib.php: call to backup_activity_structure_step->add_subplugin_structure()
  • line 88 of /backup/util/plan/backup_structure_step.class.php: call to backup_assign_activity_structure_step->define_structure()
  • line 181 of /backup/util/plan/base_task.class.php: call to backup_structure_step->execute()
  • line 216 of /backup/moodle2/backup_activity_task.class.php: call to base_task->execute()
  • line 177 of /backup/util/plan/base_plan.class.php: call to backup_activity_task->execute()
  • line 120 of /backup/util/plan/backup_plan.class.php: call to base_plan->execute()
  • line 320 of /backup/controller/backup_controller.class.php: call to backup_plan->execute()
  • line 136 of /backup/util/ui/backup_ui.class.php: call to backup_controller->execute_plan()
  • line 131 of /backup/backup.php: call to backup_ui->execute()

Any suggestions?

We cannot uninstall these plugins as we don't know how many teachers are using them...
Courses which doesn't have any assgin activities backups works fine, for those who has any assignments - fails... Even if it's only file assignment with feedback by comments... So PDF Annotate should not be used (I think so).

We have found similar issue in tracker but not all get's the same error, but no solution: https://tracker.moodle.org/browse/CONTRIB-5562


Thanks,

M.

In reply to Emma Richardson

Re: Automated backups not working and not showing

by Marius S -

Hello Emma,

We have changed to new standard pdf annotation plugin and uninstalled additional pdf submission and pdf feedback plugins.
Now we can perform manual backup and there is no error.
So we have solved one problem. Thank you very much for that.


However we still cannot make automatic backup for all courses. I suppose this is because some courses has "Next backup time" in the past (eg. Jul 12, Aug 30, etc.)

I have tryed to disable automated backups, and scheduled task auto backups, purged all cache but nothing changed in the Backup report. I still see next backup in the past.

So we should flush mdl_backup_courses and mdl_backup_controllers tables?
Old backups would get lost?

What if we would just change all timestamps in 'nextstarttime' column in mdl_backup_courses table to the future, lets say to Jan 4th?
Maybe it would work? What do you think?


Thanks,

M.

In reply to Marius S

Re: Automated backups not working and not showing

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

Glad you got the first part figured out.  I would try flushing the backup_controllers first (make a backup of it first of course).  I think that might get your dates right.  You could try with the date change first but that might cause issues if the date is not exactly what is expected from backup settings. 

In reply to Emma Richardson

Re: Automated backups not working and not showing

by Marius S -

Hello Emma,

I have backed-up mdl_backup_courses table and tryed to change  'nextstarttime' timestamp(1452072000) date to: 6th Jan 11:20 EET. I've also set this date in Courses>Backups>Automated backups settings.

I have checked Reports/backups so all backups 'Next backup' value were updated to 6th Jan 11:20.

However Cron didn't started this backup process, so I have used CLI command /usr/bin/php /admin/cli/automated_backups.php

But not all backups were made.. During backup process in Report/backups list were was a lot of 'Unifinished' backups, after backup process finished all these courses backup status changed to 'Error' (~370 courses of 2700 total) and we have 0 'Unfinished'.
Courses which have status 'Error' seems to not even tryed to be backed up, because 'Time taken' dates are still July, August, 2015, etc.

Why could this happened?
Maybe some information is stored in mdl_backup_controllers and it does not allow to perform backup of these courses?

But if I flush mdl_backup_controllers would I loose all backups or not?

Because as I understand mdl_backup_controllers stores data of courses and their backups information.
And if I flush table would old backups will get lost in Moodledata forever? or it would somehow get "regenerated" in mdl_backup_controllers table again?


PS. I can go to any "Error" course and make manual backup in the course. It works fine. So this is no longer Plugin issue I guess.


Thanks,
M.

In reply to Emma Richardson

Re: Automated backups not working and not showing

by Marius S -
I have checked mdl_backup_controllers table, so for course backups (type:course) there is oldest records which starts only from 23rd Dec, 2015 (I have also tryed to make backups in that day).
And few record from type:activity with day 12th Dec, 2015.

I'm not sure but maybe records for older backups were deleted after yesterdays backup.

So I'm not sure if flushing mdl_backup_controllers would help..

In mdl_backup_courses all "Error" courses has laststatus=0 which means Error.
What if we would change value from 0 to let's say 3(Skipped), so maybe next time I perform backup it would make a backup?
And maybe change 'laststarttime' and 'lastendtime' to Jan 6th 11:20?

One more question. Maybe it is possible somehow just try to make automatic backup ONLY for "Error" courses?

Thanks,
M.



In reply to Marius S

Re: Automated backups not working and not showing

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

Flushing the backup_controllers table does not affect existing backups.  It basically has the effect of resetting your backup status to a fresh start.  So, it should have the effect of at least getting them all to start once.

If you have are having an unfinished error, I would check that your timeouts are extended in php.ini.  They often default to 30 -  I believe that I have changed mine to 360.  Backups often take some time to complete.

In reply to Emma Richardson

Re: Automated backups not working and not showing

by Marius S -

Hello Emma,

I have tryed to TRUNCATE mdl_backup_courses table.
Set  course > auto backups to Manual, unchecked hidden  course skipping and Never skip not modified courses, because I wanted to make ALL courses backups.
Disabled sheduled tasks auto backup.
Purged all cache.

When I ran /usr/bin/php admin/cli/automated_backups.php

It was making backups, made ~30 backups from beginning, but I got another error...
At first debugging was disabled, so second time I enabled it to track error:

....
Backing up <span lang="en" class="multilang">Theatre (online course)</span>...
instantiating backup controller cb83be92a0faaacc2f5989cc467bd7a3
setting controller status to 100
loading controller plan
setting controller status to 300
applying plan defaults
setting controller status to 400
setting file inclusion to 1
checking plan security
setting controller status to 700
saving controller to db
calculating controller checksum 8941dcdbc12f7fb5cef5bc64dc7a4c58
loading controller from db
setting controller status to 700
saving controller to db
calculating controller checksum ac3ab736859893c3fd309381c3a6e385
loading controller from db
setting controller status to 800
setting controller status to 1000
saving controller to db
Default exception handler: Error processing archive file Debug: Header does not have POSIX ustar magic string
Error code: errorprocessingarchive
* line 290 of /lib/filestorage/tgz_extractor.php: moodle_exception thrown
* line 223 of /lib/filestorage/tgz_extractor.php: call to tgz_extractor->process_header()
* line 142 of /lib/filestorage/tgz_extractor.php: call to tgz_extractor->extract_or_list()
* line 645 of /lib/filestorage/tgz_packer.php: call to tgz_extractor->extract()
* line 104 of /lib/filestorage/mbz_packer.php: call to tgz_packer->extract_to_pathname()
* line 268 of /backup/util/helper/backup_general_helper.class.php: call to mbz_packer->extract_to_pathname()
* line 605 of /backup/util/helper/backup_cron_helper.class.php: call to backup_general_helper::get_backup_information_from_mbz()
* line 209 of /backup/util/helper/backup_cron_helper.class.php: call to backup_cron_automated_helper::remove_excess_backups()
* line 94 of /admin/cli/automated_backups.php: call to backup_cron_automated_helper::run_automated_backup()

!!! Error processing archive file !!!
!! Header does not have POSIX ustar magic string
Error code: errorprocessingarchive !!
!! Stack trace: * line 290 of /lib/filestorage/tgz_extractor.php: moodle_exception thrown
* line 223 of /lib/filestorage/tgz_extractor.php: call to tgz_extractor-&gt;process_header()
* line 142 of /lib/filestorage/tgz_extractor.php: call to tgz_extractor-&gt;extract_or_list()
* line 645 of /lib/filestorage/tgz_packer.php: call to tgz_extractor-&gt;extract()
* line 104 of /lib/filestorage/mbz_packer.php: call to tgz_packer-&gt;extract_to_pathname()
* line 268 of /backup/util/helper/backup_general_helper.class.php: call to mbz_packer-&gt;extract_to_pathname()
* line 605 of /backup/util/helper/backup_cron_helper.class.php: call to backup_general_helper::get_backup_information_from_mbz()
* line 209 of /backup/util/helper/backup_cron_helper.class.php: call to backup_cron_automated_helper::remove_excess_backups()
* line 94 of /admin/cli/automated_backups.php: call to backup_cron_automated_helper::run_automated_backup()
 !!

It's strange that actually this backup was made successfully, but next course backup didn't started because I got this error.
This was course ID 49 and it was made, it record was stored in mdl_backup_controllers.
However I didn't get line: complete - next execution: ....., instead I got that error message.

Do you have any idea what why we get this error?
How can we fix this?


Thanks,
M.

In reply to Emma Richardson

Re: Automated backups not working and not showing

by Marius S -

Now I'm looking to 34 courses backups which were made, last one was with ID=49

Maybe there is something wrong with this course of this is the first one which caused problems.

We store backups in coursebackup filearea and specified directory. So I can see in specified directory how many backups we actually have.

Strange thing with course ID=49
In Restore backup page of this course at first I saw 5 auto backups, 4 from Jan 13th, 2016 and 1 from August, 2015. So total 5 backups.
I tryed to run cli autobackup script one more time and it failed, and now I see only 4 backups. So August backup gone but also one Jan13th backup gone from list..

However I went to check server specified directory and actually there is 12 backup files of course ID=49 are stored!
As you can see other courses has up to 5 backups files as it should.

12 backups of course ID=49


And this is course ID=49 Restore backup page. As you can see there is only 4 backups visible in the list (should be 5)

Restore backup, only 4 backups


Maybe after making new backup Moodle tryes to delete old backups and it fails because mld_backup tables were flushed or moodledata/temp/backup/ folder was emptied?


Thanks,

M.


In reply to Marius S

Re: Automated backups not working and not showing

by Séverin Terrier -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Testers Picture of Translators

Hi,

We don't see it clearly on your screenshot : are you sure your course shortname didn't change?

Because Moodle isn't good to delete old backups if course shortname as changed (and you use in in backup filenames), and it can lead to multiple (old) backup files staying always mixed

Séverin

In reply to Séverin Terrier

Re: Automated backups not working and not showing

by Marius S -

Hello Séverin,

Course shortname didn't change, it's the same 'menn0204'.

We have tryed one more thing, we have created new folder for course backups and changed auto backup settings to store course backups ONLY in folder and ran cli script. Sheduled task autobackup was Disabled.

We ran it on Jan 15th and all courses backup were made to new folder, next backup was sheduled to Jan 17th 5AM.

On Jan 16th we set course auto backups to "Enabled", we changed back to store course backups in moodledata + new folder. In sheduled task autobackup we changed back to Enabled.

On Jan 17th 5AM auto backups didn't started... And in Sheduled tasks autobackups last run shows September 2nd, 2015... I have no idea why it changes back to this date.

If I try to reset for default values, it shows next run let's say at Jan 18th 9:50AM, but when time comes, it changes next run to ASAP. And last run is September 2nd, 2015.

sheduled tasks


So maybe this script somehow halt start of auto backups?


Thanks,

M.

In reply to Emma Richardson

Re: Automated backups not working and not showing

by Marius S -

UPDATE: Tryed to make cli autobackup with Skipped hidden courses and skipped courses which didn't change during 365 days. So course ID=49 was skipped, but on course ID=249 we got same error and autobackups stopped.

Again from server older backups was not deleted, they just haven't been display in Restore course page.

Apache has rights to delete files, moodledata and coursebackups directories has chmod 777. Backup files in coursebackups directory are with chmod 666, so it shouldn't be permissions issue.


Thanks,

M.

In reply to Marius S

Re: Automated backups not working and not showing

by Ken Task -
Picture of Particularly helpful Moodlers

mdl_backup_courses

laststatus field has number:
1 = OK
2 = unfinished
3 = skipped

query
select courseid,laststatus from mdl_backup_courses where laststatus=2

If you see an un-finished, check:
moodledata/backup/temp/ for any .log file that is larger than 0 bytes.
That log file might have info in it.

Also, if there is any 'contenthash' named directory (long string of letters/numbers)
inspect what it contains.

cd pathtomoodledata/backup/temp/[contenthash]
ls -l

IF you see a backup.mbz file therein it could be a good backup that
the operating system couldn't *copy* to destination which is a known issue
of OS's.   In this case, the course would never be copied to the designated
destination NOR would it be in filedir.

One can, however, use the command line mv command to move the .mbz file
to the designated destination.


More than likely, in the directory where you find a backup.mbz there will also be
a moodle_backup.xml file.   Use head -n 20 moodle_backup.xml  to see the XML tag that
shows the filename Moodle would have used had it been able to complete the backup.

Had a server set to do autobackups that had a course that would not backup via cron job (auto) ... similar to your situation, I think.   I finally had enough and truncated all the data in mdl_backup_courses. And the issue was resolved.

Will that work for you?   Don't know for sure.   This is one of those areas that is specific to individual servers ... ie, one solution not necessarily for all, me think.

'spirit of sharing', Ken

In reply to Marius S

Re: Automated backups not working and not showing

by Séverin Terrier -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Testers Picture of Translators

Hi,

You should also look at Cron documentation, and perhaps better use php to call cron, and use the cli version.

Perhaps also look at this message/discussion, that can provide useful information wink

HTH,
Séverin

In reply to Séverin Terrier

Re: Automated backups not working and not showing

by Marius S -

Hello Severin,

last reply had to be to your post. Yes, I have head your post before posting new topic.

I have tryed to set Manual Course>Backups>Automated backups, and in Scheduled tasks I disabled automated backups.

But when I tryed to run /admin/cli/automated_backups.php i got this:

moodle2@moodle2:~/public_html$ /usr/bin/php-cgi admin/cli/automated_backups.php      
X-Powered-By: PHP/5.4.41-0+deb7u1
Content-type: text/html

                    Server Time: Wed, 25 Nov 2015 14:20:15 +0200


Checking automated backup status...RUNNING
Automated backups are already running. If this script is being run by cron this constitues an error. You will need to increase the time between executions within cron.
Automated cron backups completed correctly
Execution took 0.073386 seconds

In reply to Marius S

Re: Automated backups not working and not showing

by Ken Task -
Picture of Particularly helpful Moodlers

Pardon intrusion ... just spotted something ...

Issue: which php
as root via command line.
That should point to /usr/bin/php

You want to use the php that's command line ... not php-cgi me thinks.
The php-cgi (cgi=common gateway interface) is using web server.
That's why you are seeing 'Content-type: text/html' in the output of the command
you issued.   That's calling apache.   The idea is to use php which will talk
to the DB only ... leaves apache out of the loop thus consumes less memory and faster.

Overall, there are some dates that are just outta whack ... and from
looking at them, don't think they'll ever complete/do.

In order to re-gain control of the situation, you **might** have to truncate
the tables for backups - leaving the tables and their fields ... just remove all the data contained in them.

The next run of automated command line backups run manually will/should backup all courses that are not hidden.   That does take the backup preferences from the GUI config of backups.

I'd also set to designated directory ONLY and not do copies into the new file system.

Tons of courses ... there's a plugin for course sizes that might help see just how large some courses are.   When the automated backups kick in, settings do NOT include 'do largest' first or last ... or skip large course over XGig ... you could have some courses failing simply because they are over 4Gig (limitation of OS).

There is another script in same location as auto_backups called 'backup.php'.   Running thusly from moodlecode/admin/cli/

php backup.php

with no parameters passed the script will bring up the help on using it.

Think, as a test, I'd pick one of those courses that has been failing, get it's course ID number, then try the backup.php script giving it the course ID and have it save to a designated directory outside of filedir to see if that course will backup.

php backup.php --courseid=[IDNUMOFCourse] --destination=/path/to/directory/outside/of/filedir/

That might give some clues ... if it fails.

'spirit of sharing', Ken


In reply to Ken Task

Re: Automated backups not working and not showing

by Marius S -
Hello Ken,

Thanks for this information.

In the server I had only /usr/bin/php-cgi and php5-cgi, so we have added and php.
And now php cli seems to work fine and /usr/bin/php /admin/cli/automated_backups.php command worked fine.
Because before I used php-cgi and I was getting max execution time error.