## Backup and restore

### automatic backup shows backup status OK for courses I expected to be skipped

automatic backup shows backup status OK for courses I expected to be skipped

Hi I'm using Moodle 2.2.6 and have recently got my automated backups working (after previously experiencing a known error message which was connected to the grids layout where I had to delete the backup folder from the grids course) but now the backups report isn't what I was expecting.

Our institution has around 900 courses / classes in total but because we are just starting to use Moodle, only 10 at most are currently being used.  As I understand it, if a course hasn't been altered after 30 days then it will be 'skipped', otherwise it will have an OK status to indicate its been backed up as changes have been made.

My confusion is that around 8 courses have been skipped and the rest show as 'OK', I was expecting the opposite as only a few courses are being used at present. To check this I have looked at the log files under admin > reports, selected a course with a backup status of OK (but one that I know hasn't been used) , selected all days from the drop down but as expected nothing appears as the course hasn't been modified.  I have done the same for a coourse I know has been modifed and the edits do appear so I know the log is producing correct info.

Does anybody know what is happening here? I've already searched the forum but can only find cases of auto backup working or not working.

Also for the automated backup settings,  when I select 'course backup file area and the specified directory' from the drop down, I have created a folder on c:\ called moodlebackup so I put C:\moodlebackup into this box, click on save and a tick appears but still no backups appear in the folder?

Michael

Average of ratings: -
Re: automatic backup shows backup status OK for courses I expected to be skipped

There might be a bug, but am wondering if the cron job has been run on a regular schedule.  There is a column (a unix date/time stamp) in tables related to when courses were last backed up or altered/changed.

Turn on debug.

The automated backups are run according to a schedule in automated backups config.  Set the time for something close to your current time.  Then run the cron job.  In the output of the cron job, one should see some lines related to automated backups.  Might have to run the cron job more than once to get automated backups to kick in if one doesn't time it right.  Consider running the cron job from the command line and run the /moodle/admin/cli/ cron job.

Since have debug turned on, Moodle might report something useful ... copy and paste the text of the error to a notepad document for later sharing here.

If you are running apache, check apache error_logs.  The autobackup process runs under user apache (if using apache) and must have access rights to be able to write to the c:\moodlebackup folder - check permissions/ownerships of that folder.

'spirit of sharing', Ken

Average of ratings: -
Re: automatic backup shows backup status OK for courses I expected to be skipped

Hi Ken, cron is scheduled to run at 8pm every night, it has been running for a few weeks now and does run as I have checked the log file as you mentioned. I have already altered the automatic backup and cron times to check that it was running as previously it was skipping all the time or erroring so at least now I know it's working.

I've also checked the backup part of several courses from the restore option. I set the number of backups retained to two in the automated backup settings and for all courses I can see two mbz backup files so it is working.

I'm using IIS on server 2008.  I assumed you just had to provide a folder location for the backup files, there is no mention of setting permissions and rights access in the documentation.

Are you suggesting to turn debugging on for when the backup is run to see if anything is reported in the log?

Michael

Average of ratings: -
Re: automatic backup shows backup status OK for courses I expected to be skipped

Debugging for manual backups to see that process is running correctly.  Obviously, that won't help with automatted backups.  However, there is commandline script called automated_backups.php in admin/cli/.  Handy for troubleshooting auto backups and forcing it to run (errors would display there).

Apache on Linux can write to directories outside document root and apache root if those have proper ownership/permissions set without having to create aliases/etc. in the apache config.  Have heard that IIS might require some config additions for that to work, thus the suggestion concerning the other directory for auto backups.

Also, the entire process requires temporary files/folders be created, copied, and then removed.  Moodle has a temp, php has a temp, and, of course the OS has a temp. When ever I have issues with backups/auto backups I check them all ... especially the moodledata/temp/backup folder/directory.

Can't remember which PHP version, but on Windows systems it had an issue with being able to 'unlink' a temporary file/folder, thus could not delete.  Those types of errors would show in apache error logs.  IIS logs? (dunno).

Inspecting the tables for Moodle, there is one for backups (controller) that uses UNIX epoch time and could see if the system/operating system or php time is not sync'd or correct or functioning, that might affect the cron'd and auto backup routines.

Sill trying to understand how that table is used. :|

'spirit of sharing', Ken

Average of ratings: -
Re: automatic backup shows backup status OK for courses I expected to be skipped

Hello Ken thank you for your reply.  I folllowed your advise, put Moodle into debugging mode and create a .bat file to run 'automated_backups.php'. I have forced this to run several times but it performed the same as previously, no errors or faults just still courses backing up 'OK' that I would expect to be skipped.

Admittedly I haven't looked in the log file areas you mentioned but wondered if it would make any difference with the backup not actually erroring?

Michael

Average of ratings: -
Re: automatic backup shows backup status OK for courses I expected to be skipped

Logs may/may not say something specific ... sometimes a 'clue' though.

As I understand the backup process, if a course hasn't changed or if a course is hidden it's supposed to be skipped.   There is a field in the tables related for date/time stamping - table mdl_backup_courses.

select * from mdl_backup_courses

The times you see are Unix epoch and one would need an epoch time translator to put them into humanly understandable dates.  I mention this only cause I've seen some strange stuff occur when the system clock was off.  Got server sync'd with a ntp server out there?

What if you create a new course.  Pretty much blank.  Then ran the autobackup .bat file?

Also, have you checked your moodledata/temp/backup folder?

'spirit of sharing', Ken

Average of ratings: -