Forums | Mahara Community

Support /
Help with Cron maybe?


04 September 2012, 19:23

Hi, I've had Mahara running for almost a year, but never got cron to work. This didnt seem to matter for a long while, but now I realise I really do need to get it working.

My system is Mahara 1.5.1, MySQL 5.1.54, Ubuntu 11.04, Authenticate through LDAP on Win 2003 Domain.

So, Ive read the docs to make Cron run ... I dont consider myself in any way an expert with linux and found the documentation a little bit terse. So, I am going to write out exactly what I did so the instructions can be found here for someone in the future. Anyway ... here's what I did...

Login to the Linux box as a normal user.

Open a terminal so I can get to the command line.

su which will log me in as root so I can do stuff (put in the root password).

ps -ef which shows me all of the processes running and who they belong to. Search through the long list and find apache. Note that the apache web server processes are owned by a user called www-data

Next I check to find the directory where my mahara files are installed. Note that on my machine the directory is /var/www/mahara. I am looking for the cron.php file in the /var/www/mahara/lib/ directory. Make sure it is there (which is is). Now, cron will make a log file for me, so I decide to put the log file into the same place, so my log file will be /var/www/mahara/lib/cron.log.

Now, the cron job can run as root (which sounds like a good idea to me) so, as the root user I enter :

crontab -e The first time you run this it will ask you what editor you would like to use. I chose nano.

Add the following line to the bottom of the cron file:

* * * * * www-data php /var/www/mahara/lib/cron.php >> /var/www/mahara/lib/cron.log 2>&1

... and saved the file.

At this stage it should all work. I log out of root and reboot just to be sure it has kicked in.

***********************************************************************************************************

My Problem :

Mahara Admin page tells me that Cron is still not running. A check of the log file showes me that my cron.log file has many lines that read :

 

/bin/sh: www-data: not found

/bin/sh: www-data: not found

/bin/sh: www-data: not found

 

Does anyone know what I did wrong??

 

 

 

05 September 2012, 18:51

Maybe I fixed this one myself ... I tried taking the www-data out of the line and suddenly there is a whole lot of stuff being written into the cron.log file. Mahara Admin still tells me that Cron is NOT running, but clearly something is happening.

Does anyone know what the www-data does ?

Anyway, now the line says :* * * * * php /var/www/mahara/lib/cron.php >> /var/www/mahara/lib/cron.log 2>&1

anonymous profile picture
Account deleted
Posts: 197

18 September 2012, 0:42

Hi Bernie,

Which cron instructions did you follow? The "real" ubuntu instructions are at https://help.ubuntu.com/community/CronHowto

If cron stops running before the script times out (if, say, you have a whole year of tasks to process ;) ), or there is a fatal error, then it will say it hasn't run.

You should check the logs for errors that happen while cron runs, they will indicate anything that might be broken.

Thanks,
Melissa.

A post by Account deleted was deleted

4 results