Where are my crons

Where are my crons

by Albert Ramsbottom -
Number of replies: 2

My moodle application is owned by root and my moodle data is www-data but I cannot find any crons under either 

crontab -e or 

crontab -u root -e or

crontab -u www-data -e


I do have 6 web servers though, so really do not want to check every one, however this bringd up another question?

We run our Moodle application code from an NFS share so what machine would I run the moodle cron from?



*/1 * * * * /usr/bin/php /path/to/moodle/admin/cli/cron.php >/dev/null

Average of ratings: -
In reply to Albert Ramsbottom

Re: Where are my crons

by Ken Task -
Picture of Particularly helpful Moodlers

Nothing is ever simple! :\

By 6 web servers does that mean 6 Moodles?

If so, each moodle needs it's own cron job as each moodle instance has it's own datadir and own code ... cept maybe in how you've described your setup ... are the 6 web servers (moodles) running off the same 'shared code base'?

And one more suggestion to add to the confusion ...

Rather than outputting cron to null - which means maybe no one sees it or the cron job results get sent to an EMail that no one checks , consider redirecting to a log -> /var/log/moodle1-cron.log and /var/log/moodle2-cron.log for the 2nd cron job (one per moodle server).

The individual cron jobs would have to execute in code/admin/cli/ as that php script is tied to task for that instance and reads config.php file for variables related to that moodle instance.

Then one could watch real time output of those cron jobs via:

tail -f /var/log/moodle1-cron.log or install multitail and setup one 'watchcron' multitail script that points to all the /var/log/moodle#-cron.log's being kept on server.

'spirit of sharing', Ken



In reply to Ken Task

Re: Where are my crons

by Albert Ramsbottom -

Hi

Yes I found them in cron.d on webserver 1

We use a shared codebase so I assume we only need the cron set up on one server

*/1 *     * * *     www-data  /usr/bin/php /var/www/html/moodle/admin/cli/cron.php > /dev/null

Maybe I will write the cron,log as I should keep an eye out for issues at this stage


Cheers Ken

PS we currently have the codebase files owned by root and the moodledata owned by www-data but the cron is run using the user www-data? Is this right?