Forums | Mahara Community

Support /
directory not writable error running cron script


anonymous profile picture
Account deleted
Posts: 72

18 October 2011, 20:55

Hello=

Using Mahara 1.4 from mahara.org, mySQL5.1.49-3, php 5.3.3-7 over Debian Squeeze3. 

The admin panel shows cron is not running.  When I try to execute at the command line I get:

[WAR] df (lib/mahara.php:162) For some reason some of the core data directories could not be created. This should not happen, as Mahara previously detected that the dataroot directory was writable. Please check the permissions on the dataroot directory.Call stack (most recent first):  * ensure_sanity() at /var/www/mahara/init.php:82  * require("/var/www/mahara/init.php") at /var/www/mahara/lib/cron.php:33

I've re-checked the data directory which seems OK (and must be as students are adding material all the time).  I've looked in crontab which seems alright:

# m h  dom mon dow   command

*/10 * * * * wget -q -O /dev/null http://localhost/moodle/admin/cron.php

*/10 * * * * wget -q -O /dev/null http://localhost/mahara/lib/cron.php

Moodle's cron is running fine.

permissions problem?  But where to look?

Any help appreciated.

Thanks

Richard

anonymous profile picture
Account deleted
Posts: 214

19 October 2011, 3:48

Hi Richard,

This may sound strange, but can you try calling it in your browser directly and see if you get the same results? I wonder whether you have some kind of issue because you're calling against localhost (this shouldn't be the case, but it can depend on your configuration).

Andrew

anonymous profile picture
Account deleted
Posts: 72

19 October 2011, 5:55

Hi Andrew

Yes, I did try that but just got the blank page indicating a php error (which I assume is similar to the one given at the command line).  Localhost ought to be OK as the crontab is on the same server as Mahara.

It is quite hard to understand the reference to "core directories" as surely these must have been created for Mahara to function normally.

Thanks

Richard

anonymous profile picture
Account deleted
Posts: 72

01 November 2011, 0:54

cron still not running.  I tried running as root and got the following mystery messages:

[DBG] 4d (lib/cron.php:45) ---------- cron running Tue, 01 Nov 2011 16:48:28 +1100 ----------
[DBG] 4d (lib/cron.php:146) Running core cron rebuild_artefact_parent_cache_dirty
[DBG] 4d (lib/cron.php:146) Running core cron activity_process_queue
[DBG] 4d (lib/cron.php:502) Skipping long-running cron job core_recalculate_quota (Tue, 01 Nov 2011            08:00:01 +1100).
[DBG] 4d (lib/cron.php:146) Running core cron import_process_queue
[DBG] 4d (lib/cron.php:168) ---------- cron finished Tue, 01 Nov 2011 16:48:28 +1100 ----------

? Mean anything to anyone

Thanks

Richard

anonymous profile picture
Account deleted
Posts: 214

01 November 2011, 4:32

Hi Richard,

The output you've given suggests that cron is indeed running and performing as expected. The way that the admin panel determines whether cron is running is to run a query:

SELECT * from cron WHERE nextrun IS NULL OR nextrun < CURRENT_DATE;

Could you try running that on your database and post your results?

I've just re-read your original post. The reason that your dataroot isn't writeable when you call it from the CLI is probably because you're running it as the wrong user. The dataroot is owned by the user which your web server runs as. On debian, this is the www-data user. So you'll need to:

sudo su - www-data

php /srv/www/mahara.myschool.com/htdocs/lib/cron.php

Let us know how you get on,

Andrew

anonymous profile picture
Account deleted
Posts: 72

02 November 2011, 20:24

Hi Andrew

Thanks for your help.  I ran the query with the result below:

cron

When using the www-data user and running cron i got:

$ php cron.php
[DBG] 65 (lib/cron.php:45) ---------- cron running Thu, 03 Nov 2011 12:13:01 +1100 ----------
[DBG] 65 (lib/cron.php:146) Running core cron rebuild_artefact_parent_cache_dirty
[DBG] 65 (lib/cron.php:502) Skipping long-running cron job core_recalculate_quota (Thu, 03 Nov 2011 08:20:02 +1100).[
DBG] 65 (lib/cron.php:502) Skipping long-running cron job core_import_process_queue (Wed, 02 Nov 2011 14:50:01 +1100).
[DBG] 65 (lib/cron.php:168) ---------- cron finished Thu, 03 Nov 2011 12:13:01 +1100 ----------

On the Mahara admin page - when I view stats it still tells me cron is not running although the activity reports seem up to date.

I don't know if it makes a difference but the maharadata directory is owned by www-data but the mahara code is owned by root.  I assume the web server only ever writes to the data directory.

Cheers

Richard

anonymous profile picture
Account deleted
Posts: 214

09 November 2011, 5:48

Hi Richard,

Sorry it's taken me so long to get back to you - I was on holiday for most of last week.

It looks like you may have some cron jobs which have hung for some reason (perhaps you restarted the server while they were running for example).

If you're sure that the cron jobs aren't running any more, then you can allow them to run again by . You'll need to try the following in SQL:

SELECT * FROM config WHERE field LIKE '%_cron_lock_%';

This should give you the locks that you need to remove. There should only be the two:

_cron_lock_recalculate_quota
_cron_lock_import_process_queue

And then you can run:

DELETE FROM config WHERE field LIKE '%_cron_lock_%;

This will remove the locks and allow those cron jobs to run successfully once again.

How frequently are you running cron? It could be that you're not running cron freuently enough and so jobs are actually taking far longer than expected.

Andrew

anonymous profile picture
Account deleted
Posts: 72

09 November 2011, 17:54

Hi Andrew

Hope you enjoyed your break.  Mine is coming up soom Smile.

Thanks, that seems to have most of it going and the admin page now shows cron is running normally.  There were a couple of errors on running the job from the command line as the www-data user (below).  I am running cron every 10 minutes.

Thanks for your help

Richard

[DBG] e9 (import/lib.php:241) an error occured on import: Failed to retrieve zip                                                              file from remote server: An error occurred at the remote server. Code: 500
[DBG] e9 (lib/cron.php:146) Running core cron export_cleanup_old_exports
[DBG] e9 (lib/cron.php:146) Running core cron import_cleanup_old_imports
[DBG] e9 (lib/cron.php:146) Running core cron cron_site_data_daily
[DBG] e9 (lib/cron.php:146) Running core cron cron_check_for_updates[WAR] e9 (lib/web.php:3071) Curl error: 56: Received HTTP code 407 from proxy after CONNECTCall stack (most recent first):  * log_message("Curl error: 56: Received HTTP code 407 from proxy ...", 8, true, true) at /var/www/mahara/lib/errors.ph                      p:109  * log_warn("Curl error: 56: Received HTTP code 407 from proxy ...") at /var/www/mahara/lib/web.php:3071  * mahara_http_request(array(size 1)) at /var/www/mahara/lib/mahara.php:2435  * cron_check_for_updates() at /var/www/mahara/lib/cron.php:149

[DBG] e9 (lib/mahara.php:2438) Could not retrieve launchpad download page
[DBG] e9 (lib/cron.php:146) Running core cron cron_clean_internal_activity_notifications
[DBG] e9 (lib/cron.php:168) ---------- cron finished Thu, 10 Nov 2011 10:45:29 +1100 ----------

François Marier's profile picture
Posts: 411

09 November 2011, 18:39

Looking at your cron log, it looks like the authentication settings for your proxy isn't quite right:

  http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.8

Cheers,

Francois

anonymous profile picture
Account deleted
Posts: 72

10 November 2011, 17:11

Hi Francois

Yes, thanks, I checked them and they were wrong. The "long-running import_process_queue" job is still being skipped - should I allow more time between runs of cron?  We are a low traffic site.

Is this related to the Moodle export to Mahara feature that we have enabled or is it referring to some other type of import?

Thanks again.

Richard

12 results