Some Auto Backups run in Cron when manually run but...

Some Auto Backups run in Cron when manually run but...

by Gordon Toudt -
Number of replies: 4

Help we need this to function properly,

Currently our Autobackups are  not completely functioning on our Linux box.  Only courses that are small are backing up when cron is forced Manually.  No autobackups appear in the Autobackups folder in Moodledata if the cron is running on the server.

Only those under 3 MB are currently backing up when manually run... Nothing backs-up when allowed to run on the server initiated cron

Settings screenshot is attached

Attachment Autobackup settings.JPG
Average of ratings: -
In reply to Gordon Toudt

Re: Some Auto Backups run in Cron when manually run but...

by Gordon Toudt -

Additional info:   Version 2.4.4+

In reply to Gordon Toudt

Re: Some Auto Backups run in Cron when manually run but...

by Ken Task -
Picture of Particularly helpful Moodlers

Oh, my ... I see 1345 hours (on 24 hour clock) that means 1:45 PM - in afternoon, correct?  That might be 'prime time' for Moodle usage.

There are other settings not shared/shown ...

skip hidden courses?

skip courses not modified in X setting?

skip courses not modified since previous backup?

The directory to which these backups are to be saved ... is 'autobackup' in the moodledata directory?

There is a command line script in /admin/cli/ called auto_backups.php

Running that as root user will show which courses are not being backed up due to no change in X days, etc. and when they are next scheduled for backup.

Might also check moodledata/temp/backup/ to see if there any files other than 0 byte .log files (which indicate success) ... ie, log files larger than 0 bytes means there's some issues.  And see if there are any folders by looooooooonnnnnng names (lettersnumbers).  If there are folders, those might contain complete backups, but ... depending upon size of the backup files and the OS used, one might find that a backup file (.mbz) is too large to 'copy' to the designated backup directory.  In that routine Moodle uses 'copy' not 'move'.

Things you could do to test ... pick a course that shows as not having changed in the last X days, and add a hidden resource or something ... ie, change something.

Run the command line auto_backup.php script again watching to see if Moodle has picked up on a change in the course and backs it up.

Since these are really archives of courses, one could move all the .mbz files currently in the 'autobackup' folder to another location.

Then, in the Moodle UI, set the time to run to some point in the very near future ... say 5 minutes from 'now'.   From the command line run the auto_backups.php script.  Run it too soon, and it will tell you it's not time yet.  A few seconds after the scheduled time, it should kick in and if using another terminal window logged on as root user and using:

watch "ls -l /fullpathto/autobackups/"

One should see those backup files begin to populate.

There are also DB tables involved.  Have you checked them for corruption/optimization recently?

mdl_backup_controllers,mdl_backup_courses,mdl_backup_files_template,mdl_backup_ids_template

The last two above may not contain any data, but the others might be worth looking into.

'spirit of sharing', Ken

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

Re: Some Auto Backups run in Cron when manually run but...

by Gordon Toudt -

The time of day in this case is irrelevant.  only about 100 users on.  No matter when I set it to run the autobackups I get an occasional backup created.  the same happens when I manually run a cron run.  In answer to your other queries.

skip hidden courses?  .... YES

skip courses not modified in X setting? .....30 days

skip courses not modified since previous backup? Yes

The directory to which these backups are to be saved ... is 'autobackup' in the moodledata directory?  Yes

There is a command line script in /admin/cli/ called auto_backups.php

Running that as root user will show which courses are not being backed up due to no change in X days, etc. and when they are next scheduled for backup.   .......... Not the issue as I just want it to back up those that are in use and have daily modifications by students using the course and submitting work.

Might also check moodledata/temp/backup/ to see if there any files other than 0 byte .log files (which indicate success) ... ie, log files larger than 0 bytes means there's some issues.  And see if there are any folders by looooooooonnnnnng names (lettersnumbers).  If there are folders, those might contain complete backups, but ... depending upon size of the backup files and the OS used, one might find that a backup file (.mbz) is too large to 'copy' to the designated backup directory.  In that routine Moodle uses 'copy' not 'move'.

Things you could do to test ... pick a course that shows as not having changed in the last X days, and add a hidden resource or something ... ie, change something.

Run the command line auto_backup.php script again watching to see if Moodle has picked up on a change in the course and backs it up.  admin/cli/automated_backups.php?  did three this time... Problem is now how do I get this to happen on an automated basis when the cron is running?  Running from the command line is not efficient if the only linux server guy is out the day(s) I need it.  It has done four now out of 15 possible backups needed with the command line run.

Since these are really archives of courses, one could move all the .mbz files currently in the 'autobackup' folder to another location.   It is set to delete any in the autobackups older than the current one.  It did not do that on the command line run.  I suspect that by-passes some setting

Then, in the Moodle UI, set the time to run to some point in the very near future ... say 5 minutes from 'now'.   From the command line run the auto_backups.php script.  Run it too soon, and it will tell you it's not time yet.  A few seconds after the scheduled time, it should kick in and if using another terminal window logged on as root user and using:

watch "ls -l /fullpathto/autobackups/"

One should see those backup files begin to populate.  Ran it and nothing happened in the autobackup folder after changing a few course items to make sure

 

There are also DB tables involved.  Have you checked them for corruption/optimization recently?

mdl_backup_controllers,mdl_backup_courses,mdl_backup_files_template,mdl_backup_ids_template

The last two above may not contain any data, but the others might be worth looking into.  Not wishing to sound totally a neophyte... where do I do this?

'state of confusion' Gordon

In reply to Gordon Toudt

Re: Some Auto Backups run in Cron when manually run but...

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

So you are getting some backups in?  Are you sure that you are including user data in your backups?  If not, then student changes will not register and so the course would be skipped.