Automated backup problem

Automated backup problem

by Anis Jradah -
Number of replies: 5

Dear All,

We are running our Moodle internal backup based on a two day retention. However, while checking the stored backups, we realized that only one course of 2GB size is being backed up on daily basis. Hence, only one course is not abiding by the assigned settings.

We are running Moodle 2.6.10

Any thoughts? 

Thanks

Anis


Average of ratings: -
In reply to Anis Jradah

Re: Automated backup problem

by Ken Task -
Picture of Particularly helpful Moodlers

What are the settings?

Like this?

Skip courses not modified since backup | backup_auto_skip_modif_days
Default: 30 days

Choose to skip courses that have not been modified since a number of days


Skip courses not modified since previous backup backup | backup_auto_skip_modif_prev
Default: No

Choose whether or not to skip courses that have not been modified since previous backup

And how often is cron job running?  Is it running successfully?

'spirit of sharing', Ken


In reply to Ken Task

Re: Automated backup problem

by Anis Jradah -

Dear Ken,

Thank you for your reply.

Please note that the our settings are as follows:

- Skip courses not modified since:  30 days

- Skip courses not modified since previous backup is set to Yes.

The cron job runs every five minutes and it is running successfully,


Any thoughts concerning our issue?


Thank you for your continuous help.

Best,

Anis


In reply to Anis Jradah

Re: Automated backup problem

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

So, are you sure that it is not following your settings?  Perhaps only the one course has been modified?

In reply to Anis Jradah

Re: Automated backup problem

by Ken Task -
Picture of Particularly helpful Moodlers

Sorry for length of this, but .....

If there has been any change to a course, it is backed up.
Is there anything in that course that changes?  Is the backup of that course failing due to size?

With automated backups someone should be getting an Email notification.
In that message, it should report the success or failure of the process.
Is there a line in that message that says something to the affect that
one course was not backed up successfully?

Afraid one is going to have to do some investigation of the DB on this.
Got a tool to query the DB?   Since this involves timing, some of the fields
you'll see will be in Unix epoch time ... therefore, you need to locate an
epoch time converter on Internet to assist.

Here is one: http://www.epochconverter.com/

First, note the course ID number.

Then using whatever tool you have to query DB, query the mdl_backup_courses table
for that course ID using:

select * from mdl_backup_courses where coursed=[courseid]

where the [courseid] above is the course id number.  Example: courseid is 41

mysql> select * from mdl_backup_courses where courseid=41;
+----+----------+---------------+-------------+------------+---------------+
| id | courseid | laststarttime | lastendtime | laststatus | nextstarttime |
+----+----------+---------------+-------------+------------+---------------+
| 19 |       41 |    1432820706 |  1432820713 | 1          |    1432976100 |
+----+----------+---------------+-------------+------------+---------------+

Then use the epoch time converter to get the dates of those fields above which are
epoch times.

If you do not include the courseid you'll be able to compare the 'troubled' course to
the other courses.

One also needs to view what might be in /moodledata/temp/backup/
A failed backup will leave a hash named directory - a long name ...
7b9b856a2e8290d3a399a99295f4344c

That's an indication of a backup that failed.

IF you see one of those directories, there is probably a hash named .log file
larger than 0 bytes.   It is ascii text so one could inspect that .log file
for a clue.

Could also inspect the contents of that directory for a moodle_backup.xml file.
That file is also text/ascii.  It is a 'roadmap' for the backup. Inspecting it, one can see the course name and other details.

That would also be a reason that a course is continually backed up.  Never finishes, therefore nothing recorded in mdl_backup_courses to indicate it completed successfully.

It is safe to remove any all files/folders from /moodledata/temp/backup/
And it is recommend when attempting to discover the issues.  Start with a clean slate, so to speak.

So ... here's what I think I'd do ...
1. remove all the rows in mdl_backup_courses - NOT the table, but the data in the table.
2. revisit the setup of automated backups.  Set Active to Active ... we'll try to force the running of it via the running of cron.
TEMP set the Execute at time say 5 minutes into the future of present time.
Present time: 8:46 ... set Exceute at: 8:51.

I'd also set Specified directory for automated backups to something outside of
moodle's filedir.   Something like:
/home/autocoursebackups/
 
You must create directories manually.  Moodle will not create them for you.

Then run the cron job manually ... either command line:
cd /pathtomoodlecode/admin/cli/
php cron.php

OR via browser:

http://moodle/admin/cron.php

Run it multiple times until you see the automated backups kick in.

When it does, you'll see this in the cron job output:

Checking courses
Skipping deleted courses...0 courses
Running required automated backups...
... started 08:55:38. Current memory use 12.2MB.
Backing up Moodle26...
complete - next execution: Tue, 14 Jul 2015 08:55:00 -0500
Backing up Tinker...
complete - next execution: Tue, 14 Jul 2015 08:55:00 -0500
Backing up Creating Student e-Portfolios with Google Sites...
complete - next execution: Tue, 14 Jul 2015 08:55:00 -0500
Backing up SA...
complete - next execution: Tue, 14 Jul 2015 08:55:00 -0500
Backing up iPads 101...
complete - next execution: Tue, 14 Jul 2015 08:55:00 -0500
Backing up M2 GBU!...
complete - next execution: Tue, 14 Jul 2015 08:55:00 -0500
Backing up Advanced Moodle Administration (Linux)...
complete - next execution: Tue, 14 Jul 2015 08:55:00 -0500
Backing up Android Apps...
complete - next execution: Tue, 14 Jul 2015 08:55:00 -0500
Backing up 2 Moodles Compared...
complete - next execution: Tue, 14 Jul 2015 08:55:00 -0500
Sending email to admin
Automated backups complete.

And in the designated directory one should see all the courses:

[root@sos cli]# ls -l /home/autobackups/*201507*
-rw-rw-rw- 1 root apache 676682441 Jul 13 08:57 /home/autobackups/backup-moodle2-course-1689-android-20150713-0757.mbz
-rw-rw-rw- 1 root apache   1491118 Jul 13 08:57 /home/autobackups/backup-moodle2-course-1690-2mdlcomp-20150713-0757.mbz
-rw-rw-rw- 1 root apache   6078880 Jul 13 08:55 /home/autobackups/backup-moodle2-course-1-mdl26-20150713-0755.mbz
-rw-rw-rw- 1 root apache   1099043 Jul 13 08:56 /home/autobackups/backup-moodle2-course-34-sa-20150713-0756.mbz
-rw-rw-rw- 1 root apache  15467026 Jul 13 08:56 /home/autobackups/backup-moodle2-course-37-ipads-20150713-0756.mbz
-rw-rw-rw- 1 root apache  33750836 Jul 13 08:56 /home/autobackups/backup-moodle2-course-39-m2gbu-20150713-0756.mbz
-rw-rw-rw- 1 root apache  67885978 Jul 13 08:55 /home/autobackups/backup-moodle2-course-3-tinker-20150713-0755.mbz
-rw-rw-rw- 1 root apache  25699450 Jul 13 08:56 /home/autobackups/backup-moodle2-course-41-ama-20150713-0756.mbz
-rw-rw-rw- 1 root apache   9251407 Jul 13 08:56 /home/autobackups/backup-moodle2-course-6-eportfolio-20150713-0756.mbz

and one should get an email notification:

Summary
==================================================
  Courses; 9
  OK; 9
  Skipped; 0
  Error; 0
  Unfinished; 0
  Warning; 0
  Automated backup pending; 0

  Backup completed successfully

If it's all good, reset the options to Automated backups to something
sensible.

'spirit of sharing', Ken

Average of ratings: Useful (3)
In reply to Ken Task

Re: Automated backup problem

by Anis Jradah -

Dear Ken,

Thank you for your detailed feedback.

I will follow all the steps mentioned above and keep you updated.


Best regards,

Anis