Moodle 2.0 Backup not completing

Moodle 2.0 Backup not completing

by Peter Evans -
Number of replies: 23

I upgraded to Moodle 2.0 a few days ago without any issues. However now it does not seem like the automated backup job is completing properly.

Each time I check the status of the cron.php job, I get the following message at the bottom of the job:

 

Running clean-up tasks...
Deleted old log records
Deleted old backup records
Deleted old cache_text records
Notified login failured
checking for create_password
Executed tag cron
Cleaned up contexts
Cleaned cache flags
Built context paths
Cleaned up read notifications
Finished clean-up tasks...
Checking automated backup status...RUNNING
automated backup are already running. Execution delayed
Running auth crons if required...
Running cron for auth/mnet...
Running enrol crons if required...
Running cron for enrol_self...
Running cron for enrol_cohort...
...preventing stats to run, last execution was less than 20 hours ago.
Fetching external blog entries...Deleting blog associations linked to non-existent contexts...Starting registration update on hubs...
Finished registration update on hubs.
Deleting old draft files... Deleting session linked tokens more than one day old...done.
Cron script completed correctly
Execution took 52.744855 seconds

It always say "the automated backups are aleready running". Any idea how I can check where this miht be hanging up?

 

Any help is greatly appreciated.

Average of ratings: -
In reply to Peter Evans

Re: Moodle 2.0 Backup not completing

by Peter Evans -

If at all possible I would still love to get someone's help with this. It seems that not matter what I try the Backup juob never completes. Everytime I check the status through cron.php I get the following message:

Checking automated backup status...RUNNING
automated backup are already running. Execution delayed

Any help is greatly appreciated.

In reply to Peter Evans

Re: Moodle 2.0 Backup not completing

by Arnold Mühren -

Peter

I had the same puzzling error message that you're getting with the regular /admin/cron.php script. It took me some time to find out about this workaround:

If you have rights access to the server (and assuming it is linux), you may want to have a go with the optional commandline script (cli) automated_backups.php in folder /var/www/yoursitefolder/admin/cli/. You will need to set automated backups to 'manual' in the admin interface of the site (Courses/Backups/Automated backup setup).

You cannot call this script from a web browser! I tried it out using Putty (for remote commandline access to the server) and when it worked (hurray!) I set up a scheduled cron job in Webmin (the graphical interface tool for linux servers). This is the command I used:

php /var/www/mysitefolder/admin/cli/automated_backups.php

(space after php)

Let us know what happens.

Cheers, Arnold

P.S. The regular cron needs to keep running as well of course because it also does all the other little jobs like triggering the mailer.

In reply to Arnold Mühren

Re: Moodle 2.0 Backup not completing

by Peter Evans -

Thank you so much for the response. However I am still having a few issues.

I set the Backups to "Manual" per your suggestion. Now when I run cron.php I get the following output:

Checking automated backup status...INACTIVE

Which is correct. However, when I run the automated_backups.php script, I get the following output:

Checking automated backup status...RUNNING

automated backups are already. 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.123424 seconds

So I am stumped once again. Any idea why it thinks the autmated backups are still running even though the they are set to Manual.

Any help is once again greatly appreciated.

In reply to Peter Evans

Re: Moodle 2.0 Backup not completing

by Arnold Mühren -

This is strange. But... you're getting a completion message at the end of the script. I am sure you have checked the folder where the automated backups (should) go and seen there's nothing there? Of course, silly of me to ask.

This is the full report I get when running the script:

muhren@server:~$ php /var/www/lds/admin/cli/automated_backups.php
PHP Deprecated:  Comments starting with '#' are deprecated in /etc/php5/cli/conf.d/mcrypt.ini on line 1 in Unknown on line 0
Server Time: Thu, 09 Dec 2010 17:20:09 +0100

Checking automated backup status...OK
Getting admin info
Checking courses
Skipping deleted courses...0 courses
Running required automated backups...
Backing up eLearningDesign Shop...complete - next execution: Friday, 10 December 2010, 12:00 AM
Backing up The Rime of the Ancient Mariner...complete - next execution: Friday, 10 December 2010, 12:00 AM
Backing up Albert's Bridge, a radio play by Tom Stoppard...complete - next execution: Friday, 10 December 2010, 12:00 AM
Backing up Course Fullname 101...complete - next execution: Friday, 10 December 2010, 12:00 AM
Sending email to admin
Automated backups complete.
Automated cron backups completed correctly
Execution took 28.716381 seconds
muhren@server:~$

And this the data in my backup_courses table after the above:

I am copying over here so you can compare. What's the nextstarttime in your database? Is it perhaps a point in time in the past? This is a long shot...

For now, Arnold

(timestamp converter if you haven't got one at hand: http://www.4webhelp.net/us/timestamp.php)


In reply to Arnold Mühren

Re: Moodle 2.0 Backup not completing

by Peter Evans -

I have the courses all set to backup to the Course backup area, the default.

When I look at the mdl_backup_courses table, all the courses list the nextstarttime as "1291111200".

 

Some if this is new to me so I am not exactly sure what that means.

In reply to Peter Evans

Re: Moodle 2.0 Backup not completing

by Arnold Mühren -

I understand there are no .mbz files (new moodle backup extension) in the default course backup area? You have checked the last section - Automated backups - of the Restore page of the course(s) your moodle contains?  Nothing there, right?

This seems plausible since the timestamp in the nextstarttime table field is indeed in the past and that may prevent the back-up from taking place (I guess but am not 100% sure). See date that the converter produces for your timestamp:

(A timestamp is a unique numerical representation of a date; linux uses timestamps for all computations involving time)

Okay, another little expertiment.
Can you define a 'backups' folder in moodledata folder with full rights (777) for user www-data and group www-data. The moodledata folder may have these user and group + rights already but you need to ascertain a newly added folder inside it (here: backups) also has them.

Then set this back-up folder in the moodle: Site adminstration/Courses/Backups/Automated backup setup  -- - Automated backup storage = Specified directory / Save to = /var/moodledata/yoursitefolder/backups

And then see what happens if you trigger the automated_backup.php script from the command line once more.

(By the way, have you got an awful lot of courses on this moodle?)

For now.

In reply to Arnold Mühren

Re: Moodle 2.0 Backup not completing

by Stefan Eberhard -

Same problem here!

 

No automated backups at all. Worked absolutely precise as lon as we used 1.9.10. No chance with Moodle 2.

Situation: We had to restore moodle, moodledata and the database after errors during converting to moodle2. So there can be confusion in the timesstamps.

Any workakaround?

In reply to Stefan Eberhard

Re: Moodle 2.0 Backup not completing

by Stuart Mealor -

Just to add a little more info...

We had a site upgraded to Moodle 2.0 and it did complete backups OK at first.

But now it has stopped, with that same message:

Checking automated backup status...RUNNING
automated backup are already running. Execution delayed

It certainly seems like something is at fault with the current backup process sad

Could it be a PHP timeout problem I wonder?


In reply to Stuart Mealor

Re: Moodle 2.0 Backup not completing

by Arnold Mühren -

Same message here. I used the commandline back up file (admin/cli/automated_backups.php) as a workaround on an upgraded install with four or five courses. Yes it worked initially for me too but not for long.

The problem is not specific to upgraded installs. Also on a fresh install (2.0) automated backup works only once. And it makes no difference if you use the regular admin/cron.php script or the admin/cli/automated_backups.php script. I tried both, each on a separate fresh install - same result. It can't be a timeout problem surely - a fresh install only has an empty frontpage 'course' that gets backed up. No bytes to speak of.

Must be a bug.

In reply to Arnold Mühren

Re: Moodle 2.0 Backup not completing

by Stefan Eberhard -
In reply to Stefan Eberhard

Re: Moodle 2.0 Backup not completing

by Arnold Mühren -

Might be related yes.
I added a comment to http://tracker.moodle.org/browse/MDL-25811

In reply to Arnold Mühren

Re: Moodle 2.0 Backup not completing

by Stefan Eberhard -

Upgrading form 1.9.10 to 2.0 we hat a fatal error (2 tables of the database were utf8_unicode.ci instaed of utf8_general_ci) . What about the others facing the same backup-problem. Perhaps one can find the reason in the database update?!

In reply to Stefan Eberhard

Re: Moodle 2.0 Backup not completing

by Colin Fraser -
Picture of Documentation writers Picture of Testers

The thought of upgrading is a good one, but I suspect reality is that there are a number of issues yet to be discovered and resolved. Best bet is to just install new Moodle. Change cookie prefixes and start swapping things over, make sure it is in full mode first, fully tested and everyone is well trained in using it. Moodle 2.0.x is VERY different.

In reply to Colin Fraser

Re: Moodle 2.0 Backup not completing

by Arnold Mühren -

My latest findings are that on an upgraded site (1.9.x to 2.0 or 2.0.1) neither the regular /admin/cron.php script nor the admin/cli/automated_backups.php script triggers a (correct) backup process.  The error message cryptically says the backup process is already running so it is not activated.

On a fresh 2.0 install, however, there are two different results:

1) The automated_backups.php script works fine (regardless whether the script is called on the server commandline or via a cron job on the server). Now the interesting part! I did this in two steps: First, I ran the script with only the main frontpage 'course' on the site. It worked. Then I restored, onto this fresh site, 3 courses backed up individually from the upgraded site mentioned above. And this also worked. Nice to know for those with just some courses on a site, but not tens or hundreds...

2) Automated backups via the regular /admin/cron.php, however, does NOT work on this fresh 2.0 site at all.

Hmm.

In reply to Arnold Mühren

Re: Moodle 2.0 Backup not completing

by Chad Outten -

@Arnold: which command are you using for your cron jobs?

cd '/pathtomoodle/admin/' ; php -q 'cron.php' > /dev/null ;

or...

wget -q -O /dev/null http://www.yourmoodle.com/admin/cron.php

i was using first command without issue for 1.9.x and upon upgrading to moodle 2.0 - i discovered my jobs were no longer running. reconfigured job with second command and all ok.

HTH

 

In reply to Chad Outten

Re: Moodle 2.0 Backup not completing

by Arnold Mühren -

Hi Chad,

"reconfigured job with second command and all ok"

Okay but does the cron.php script also trigger the automated back-ups on your 2.0 site?!

For me too, the admin/cron.php runs fine on 2.0 - I also use the wget command on a cron job - for everything (mail etc) except the automated backups part of the script. Therein lies the problem.

The workaround as mentioned earlier in this thread, is using the optional automated_backups.php (in the admin/cli folder) which does work on 2.0  provided the 2.0 site is not an upgraded 1.9 site but a fresh install. The command for this workaround is:

php /var/www/sitefolder/admin/cli/automated_backups.php
(space after php)

The remedial work for 2.1 will surely sort these issues out...

In reply to Arnold Mühren

Re: Moodle 2.0 Backup not completing

by Chad Outten -

Hi Arnold,

Yes - automated backups running, but not to schedule. however, I do have an issue with automated backup behaviour. not sure if the cron and backup are directly related issues or independent bugs? can you replicate my test...

http://moodle.org/mod/forum/discuss.php?d=166044


In reply to Chad Outten

Re: Moodle 2.0 Backup not completing

by Arnold Mühren -

Chad

Setting automated backups to enabled, and scheduling it, doesn't work on my 2.0 site. This script (let's call it A) seems to be dysfunctional somehow.

If A is set to manual and the automated_backups.php script (B) is subsequently run, backups are produced fine but yes, the backup_auto_keep setting (part of process A) is ignored. Script B then, run on its own, does just fine what it says it does - back up - and no more.

My hunch is that scheduling, time handling and cleaning up are prevented by hiccoughs in the interaction of script A (and its required scripts?) and/or database entries. My poor head is spinning.

- Arnold

In reply to Arnold Mühren

Re: Moodle 2.0 Backup not completing

by Chad Outten -

Thanks for testing, Arnold. Certainly reads like a bug. I'd encourage you to vote on MDL-25863 and/or add your own issue over at Moodle Tracker describing what you've encountered.

In reply to Chad Outten

Re: Moodle 2.0 Backup not completing

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

I am getting the same error when running the automated_backups.php.  Tells me that the cron job is already running.  I cannot backup at all except manually for each course.

In reply to Chad Outten

Re: Moodle 2.0 Backup not completing

by Luca Mazzola -

Hi all,

I posted our workaround (pay attention, is not a solution!!! sad ) for unblocking the automatic backup in the Moodle Tracker as a commneti to the already opened MDL-25811.

Hope this could avoid some hours of research to other with the same issue. wink

Cheers,

Luca.

Average of ratings: Useful (2)
In reply to Luca Mazzola

Re: Moodle 2.0 Backup not completing

by Paul Vaughan -

Thanks, Luca, you got my backups working. smile Here's hoping the tracker entry MDL-25811 gains enough weight to get looked at soon, as it appears to be being somewhat ignored. sad

In reply to Arnold Mühren

Re: Moodle 2.0 Backup not completing

by Stefan Eberhard -

Do you use myIsam or innoDB?

I am about to change to innoDB