Note: You are currently viewing documentation for Moodle 3.7. Up-to-date documentation for the latest stable version of Moodle may be available here: Cron.

Talk:Cron: Difference between revisions

From MoodleDocs
(Go Howard, Go :))
 
(10 intermediate revisions by 2 users not shown)
Line 11: Line 11:
*[[Cron with UNIX]] page - move section
*[[Cron with UNIX]] page - move section
*[[Cron reports]]
*[[Cron reports]]
*[[Cron settings]]
Comments? --[[User:chris collman|chris collman]] 23:25, 12 November 2011 (WST)
Comments? --[[User:chris collman|chris collman]] 23:25, 12 November 2011 (WST)


==Will create change on this page later==
Notice that I am using the phrase "the Moodle cron process". As I understand it, this process can be triggered via admin/cron.php  OR via a cron service at admin/cli/cron.php. Frankly, I am not sure how lib/cronlib.php  works with either of these trigeer points but I don't think that is important for the site admin.  The old cron page refered to cron.php with the assumption that it was in admin.  To avoid confusion for a new user, I decided to call it a Moodle cron process.--[[User:chris collman|chris collman]] 23:57, 19 November 2011 (WST)
Not hearing any immediate response to my proposals, I will wait a few days before I change things--[[User:chris collman|chris collman]] 22:58, 17 November 2011 (WST)


Seems excessive to create a Cron settings page but why not, that is consistent with other functions --[[User:chris collman|chris collman]] 22:02, 19 November 2011 (WST)
:Hi Chris, thanks for your work in improving the cron documentation and sorry for taking so long to reply to your comments. Unfortunately I have no knowledge of the cron, however the good news is that Howard has offered to help improve all of our installation documentation, so he'll most likely review the cron documentation too :-) --[[User:Helen Foster|Helen Foster]] 17:14, 23 November 2011 (WST)
 
::Super.   Course Completion has been crashing the Moodle Cron process, so I got my nose in it.  I am still at Cron 101Looking forward to Howard cleaning it upHaving it in seperate pages should help. --[[User:chris collman|chris collman]] 04:38, 24 November 2011 (WST)
::'''DRAFT OF NEW CRON PAGE STARTS HERE''' (will remove later)
Cron is the name of a Unix program that runs predefined tasks on a computer at regular intervals. The cron process in Moodle assists some modules to perform tasks on a scheduled basis. For example, the cron process might tell Moodle to check all discussion forums so it can mail out copies of new posts to people who have subscribed to that forum.  
 
The Moodle cron process can not tell itself to run.  It is a best practice to set up a cron service either on the hosting web server, another server or on another computer that will tell the Moodle cron process to run.   
 
:Note: Asking a human to use their browser to run the Moodle cron process every five or ten minutes,or when anybody on the site thinks it needs to be run is not a best practice.  The outside cron service provides a "heartbeat" so that the Moodle cron process can perform functions at periods defined for each module that needs it.
 
==Starting cron==
There are a number of way to invoke Moodle cron process. Cron can be started from the address bar in a browser (For example http:demo.moodle.net/admin/cron.php), via a [[Daemon]], or wq1et, curl or some other code.
 
===Cron service location and timing===
Note that the machine providing the cron service  '''does not need to be the same machine that is running Moodle'''. For example, if you have a limited web hosting service that does not have a cron service, then you might choose to run cron on another server or on your home computer. All that matters is that the Moodle cron process is run on a regular basis.
 
The load of the Moodle cron process on the Moodle server is not very high, so 5 minutes is usually reasonable.  However if you're worried about it you can reduce the time period to something like 15 minutes or even 30 minutes.
:It's best not to make the time period too longFor example delaying mail-outs can slow down activity within the course and create a large mail outbox to processOr student want to see their activity and course completions updated quickly.   
 
===Testing cron and manual trigger===
On a new Moodle install or upgrade, it is a good idea to test the Moodle cron process directly from your browser: ''<nowiki>http://example.com/moodle/admin/cron.php</nowiki>''  (See [[Cron settings]] if this does not work).
 
Next, you need to set up a way to manage an automatic scheduled process to run the script on a regular basis. This will depend upon the operating system and program you select.
 
:Note: When the Moodle cron process is called from cron service, 'the command line' trigger creates a temporary admin environment (similar to a login) in order to run and then deletes that environment. You can disable command line running of cron by disabling the appropriate section in the cron.php file.
 
 
::'''END OF DRAFT PAGE HERE'''

Latest revision as of 20:38, 23 November 2011

Comment from Eloy:

"If there is some template to mark one page as "require some love" I'd say https://docs.moodle.org/en/Cron requires it. It talks 99% of the time to use web-browser cron. Only 1 line talks about cli cron." --Helen Foster 20:44, 9 November 2011 (WST)

I just noticed this comment. Cron is not one of my special areas of knowledge but obviously use it. Did a quick "Cron CLI" on the web and got lost in how to program a php file to run cron jobs. Saw the note about 2.0 and CLI on this page.

I think Eloy's comment is also saying that this page is too long and could be split up? For example use a navtrail and a Cron template. Proposed pages:

Comments? --Chris collman 23:25, 12 November 2011 (WST)

Notice that I am using the phrase "the Moodle cron process". As I understand it, this process can be triggered via admin/cron.php OR via a cron service at admin/cli/cron.php. Frankly, I am not sure how lib/cronlib.php works with either of these trigeer points but I don't think that is important for the site admin. The old cron page refered to cron.php with the assumption that it was in admin. To avoid confusion for a new user, I decided to call it a Moodle cron process.--Chris collman 23:57, 19 November 2011 (WST)

Hi Chris, thanks for your work in improving the cron documentation and sorry for taking so long to reply to your comments. Unfortunately I have no knowledge of the cron, however the good news is that Howard has offered to help improve all of our installation documentation, so he'll most likely review the cron documentation too :-) --Helen Foster 17:14, 23 November 2011 (WST)
Super. Course Completion has been crashing the Moodle Cron process, so I got my nose in it. I am still at Cron 101. Looking forward to Howard cleaning it up. Having it in seperate pages should help. --Chris collman 04:38, 24 November 2011 (WST)