Only one backup being kept

Only one backup being kept

by Tony Neath -
Number of replies: 5

I am testing a sandbox setup. Moodle 2.7 Running on a windows 2008R2 server with MySQL.

In order to backup courses greater than 4Gb I have added an Ubuntu server. This is connected to the MySQL database on the Windows server and also has the Moodle data folder mounted.

I am using automated_backups.php running on the Ubuntu server at the moment being manually started from the command line.

All courses Including those above 4Gb are backing up correctly. The script is picking up settings such as Skip courses not modified since 365 days, Store in course backup filearea and use course name in backup filename from the Automated backup setup page.

The only problem I have is that I have the backup_auto_keep set to 2 but only the latest backup appears in the course automated backups. The older one is being moved to trash.

Is this because my courses are unchanged since the last backup?

All courses modified it the last 365 days are being backed up every time I run the backup. The console shows me some that are skipped because they have not been modified in the last 365days.

Average of ratings: -
In reply to Tony Neath

Re: Only one backup being kept

by Tony Neath -

I have an update on this.

In order to speed up my tests and allow me to keep more backups I set the automatic backups to only backup courses changed in the last 3 days.

This meant that I backed up only 2 courses. I was then able to set backup_auto_keep to 5.

I ran the backup until I had 5 backups in the Automated backups area of both courses.

The next time I ran the backup the number of backups was reduced to 4 the oldest 2 of my backups where deleted and a new one added.

I ran the backup again and the number of backups remained at 4 with the oldest being deleted and a new one added. This happens every time I run a backup.

So It looks like there is a bug in the script. The logic is wrong some were and the number set in backup_auto_keep  is being incremented by -1

The snag is there is not an option for 3 backups so I can only set to keep 1 by using the setting for 2 or 4 by using the setting for 5.


 

In reply to Tony Neath

Re: Only one backup being kept

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

I don't know what to say : i've never had this problem, and always the good number of backup files smile

Sorry not being able to help...

In reply to Séverin Terrier

Re: Only one backup being kept

by Tony Neath -

I did A bit more testing.

As the 2 courses I am backing up are only a few Megabytes I was able to run the command line backup on the Windows server.

This produces the same result with backup_auto_keep set to 5 the oldest backup of the 4 listed is deleted and replaced with a new one.

I then edited the database with PhpMyadmin so that the backup_auto_keep value was 3 and this kept 2 copies of the backup.

I have requested some help from a php developer at my college next week.


In reply to Tony Neath

Re: Only one backup being kept

by Melissa Benson -

I am seeing that only 1 backup is being kept for courses too, even though I have it set to 2.

In reply to Melissa Benson

Re: Only one backup being kept

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

Which exact Moodle version?

Have you made some code changes?

How are your backups configured?