I’m setting up a crucial Moodle Cron script using these instructions: moodle docs on cron and croning in windows.
I downloaded a file that helps create a Windows service to run the cron.php file. Each server gets one Windows service, but during setup, I’ll provide URLs for the cron.php file for each Moodle installation. For example, if I have four Moodle instances, one Windows service will manage four URLs, each pointing to a separate instance’s cron.php.
This service will run every 20 minutes.
After installation, the “Moodle Cron” service appears in the Services list, running with “Automatic” startup. I’ve also configured it to log information to the Windows logs.
To test, I manually ran the cron.php script in my browser, which is the first time since the instance was installed. Here’s what happened:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
| _Server Time: Thu, 26 Jul 2012 14:45:17 +0000
Created missing context instances
Cleaned up stale user sessions
Running auth crons if required...
Running enrol crons if required...
Running cron for enrol\_self...
Running cron for enrol\_cohort...
Starting activity modules
Processing module function assign\_cron ...done.
... used 6 dbqueries
... used 0.24495100975037 seconds
done.
Processing module function chat\_cron ...... used 6 dbqueries
... used 0.045751094818115 seconds
done.
Processing module function forum\_cron ...Starting digest processing...
Cleaned old digest records
... used 8 dbqueries
... used 0.060887098312378 seconds
done.
Processing module function quiz\_cron ...
Looking for quiz overdue quiz attempts between Thursday, 1 January 1970, 12:00 AM and Thursday, 26 July 2012, 2:44 PM...
Considered 0 attempts in 0 quizzes.
Starting quiz reports
Processing cron function for quiz\_statistics...
done. (1 dbqueries, 0 seconds)
Finished quiz reports
... used 11 dbqueries
... used 0.1676881313324 seconds
done.
Processing module function scorm\_cron ...Updating scorm packages which require daily update
... used 7 dbqueries
... used 0.025831937789917 seconds
done.
Processing module function workshop\_cron ... processing workshop subplugins ...
Starting workshop allocation methods
Processing cron function for workshopallocation\_scheduled...
... no workshops awaiting scheduled allocation. done. (1 dbqueries, 0 seconds)
Finished workshop allocation methods
... used 6 dbqueries
... used 0.047085046768188 seconds
done.
Finished activity modules
Starting blocks
Processing cron function for rss\_client....
0 feeds refreshed (took 0.014437 seconds)
done.
Finished blocks
Starting admin reports
Finished admin reports
Starting main gradebook job...
done.
Starting processing the event queue...
done.
Starting the completion cron...
done
Starting course reports
Finished course reports
Starting gradebook plugins
Finished gradebook plugins
Fetching external blog entries...done.
Deleting blog associations linked to non-existent contexts...done.
Starting registration update on hubs...
Finished registration update on hubs.
Outdated or missing info about available updates, forced fetching ... sending notifications ... Invalid address: noreply@10.2.28.7Could not instantiate mail function.
Error: lib/moodlelib.php email\_to\_user(): Could not instantiate mail function.
Invalid address: noreply@10.2.28.7Could not instantiate mail function.
Error: lib/moodlelib.php email\_to\_user(): Could not instantiate mail function.
Invalid address: noreply@10.2.28.7Could not instantiate mail function.
Error: lib/moodlelib.php email\_to\_user(): Could not instantiate mail function.
Invalid address: noreply@10.2.28.7Could not instantiate mail function.
Error: lib/moodlelib.php email\_to\_user(): Could not instantiate mail function.
Invalid address: noreply@10.2.28.7Could not instantiate mail function.
Error: lib/moodlelib.php email\_to\_user(): Could not instantiate mail function.
done
Deleting session linked tokens more than one day old...done.
Starting repository plugins
Processing cron function for repository\_dropbox...
done. (1 dbqueries, 0 seconds)
Finished repository plugins
Starting admin tools
Processing cron function for tool\_qeupgradehelper...
done. (1 dbqueries, 0 seconds)
Finished admin tools
Checking automated backup status...INACTIVE
Deleting old draft files... done.
Deleting orphaned preview files... done.
Cleaning up files from deleted contexts... done.
Deleting trash files... done.
Clean up cached external files
Cron script completed correctly
Execution took 11.762365 seconds"_
|
This output provides insights into the script’s actions within Moodle, like refreshing data and performing cleanup tasks. I noticed that the server’s IP might need registration for email functionality due to errors. The entire process took 11 seconds. I am curious if subsequent runs will be faster as some tasks might be one-time operations.
Interestingly, refreshing the browser and running the cron again resulted in a much faster execution time of 0.615031 seconds.