« Cron » : différence entre les versions
(Page créée avec « {{Installation}}{{Traduction}} Le processus Moodle ''cron'' est un script PHP, partie intégrante de la distribution standard de Moodle, qui doit être lancé régulièrement... ») |
(Suite traduction) |
||
Ligne 4 : | Ligne 4 : | ||
'''IMPORTANT ! Ne sauter pas l'étape de configuration du processus cron sur le serveur hébergeant votre installation de Moodle. Votre site ne fonctionnera pas correctement sans lui !''' | '''IMPORTANT ! Ne sauter pas l'étape de configuration du processus cron sur le serveur hébergeant votre installation de Moodle. Votre site ne fonctionnera pas correctement sans lui !''' | ||
Un programme spécial, habituellement appelé ''cron'', est utilisé pour lancer le script cron de Moodle à intervalles réguliers. Le script cron de Moodle lance plusieurs tâches, notamment l'envoi des courriels, la mise à jour des rapports, des flux RSS, de l'achèvement d'activités, le suivi des messages des forums, etc. Comme ces différentes tâches doivent être lancées à des intervalles différents, toutes les tâches ne sont pas lancées lors de chaque exécution du script cron de Moodle. | |||
Le programme cron (qui lance le script cron de Moodle) fait partie de façon standard des systèmes Unix (y compris Linux et OS X) et est utilisé pour lancer toutes sortes de services dépendant de l'heure. Sous Windows, la solution la plus simple pour répliquer ce comportement est de créer une tâche dans le Gestionnaire des tâches Windows et de la faire lancer à intervalles réguliers. Sur les serveurs mutualisés, il vous faudra trouver la documentation (ou demander de l'assistance) sur la façon de configurer le cron. | |||
Normalement, il s'agit d'ajouter une unique commande à la liste des activités du cron de votre système. Sur les systèmes Unix, cette liste est contenue dans le fichier dénommé ''crontab'', propre à chaque utilisateur. | |||
== | == Discussion générale == | ||
Ce paragraphe détaille diverses informations de base. Voyez plus loin pour des instructions propres à votre type de serveur. | |||
There are essentially two steps to implementing cron: | There are essentially two steps to implementing cron: | ||
Ligne 21 : | Ligne 21 : | ||
Moodle has two different ways to deploy cron which use different scripts within the Moodle install. These are as follows... | Moodle has two different ways to deploy cron which use different scripts within the Moodle install. These are as follows... | ||
# The CLI (command line interpreter) script. This will be at the path | # The CLI (command line interpreter) script. This will be at the path <pre>/path/to/moodle/admin/cli/cron.php</pre> If in doubt, this is the correct script to use. This needs to be run by a 'PHP CLI' program on your computer. So the final command may look something like <pre>/usr/bin/php /path/to/moodle/admin/cli/cron.php</pre> You can (and should) try this on your command line to see if it works. | ||
# The web based script. This needs to be run from a web browser and will be accessed via a web url something like '''http://your.moodle.site/admin/cron.php'''. You can find command line based web browser (e.g. wget) so the final command may look like | # The web based script. This needs to be run from a web browser and will be accessed via a web url something like '''http://your.moodle.site/admin/cron.php'''. You can find command line based web browser (e.g. wget) so the final command may look like <pre>/usr/bin/wget http://your.moodle.site/admin/cron.php</pre> This has the advantage that it can be run from *anywhere*. If you can't get cron to work on your machine it can be run somewhere else. | ||
=== Finding the right place to put the command === | === Finding the right place to put the command === | ||
Ligne 54 : | Ligne 55 : | ||
*[[Cron on 1and1 shared servers]] | *[[Cron on 1and1 shared servers]] | ||
== Using third party cron service == | |||
Besides using cron hosted on your own server, you may use third party cron service (usually called webcron): | |||
*[http://www.easycron.com EasyCron] - A webcron service provider that eliminates the need of crontab or other task schedulers to set cron job. | |||
=== Cron settings in Moodle === | === Cron settings in Moodle === | ||
Ligne 65 : | Ligne 72 : | ||
==See also== | ==See also== | ||
* [http:// | * [http://en.wikipedia.org/wiki/Cron Wikipedia article on cron function] | ||
Using Moodle forum discussions: | |||
*[http://moodle.org/mod/forum/discuss.php?d=41827 Cron - can someone give me a quick confirmation of function?] | *[http://moodle.org/mod/forum/discuss.php?d=41827 Cron - can someone give me a quick confirmation of function?] | ||
*[http://moodle.org/mod/forum/discuss.php?d=97684 Cronjob Question] | *[http://moodle.org/mod/forum/discuss.php?d=97684 Cronjob Question] |
Version du 28 juin 2013 à 20:25
Remarque : la traduction de cette page n'est pas terminée. N'hésitez pas à traduire tout ou partie de cette page ou à la compléter. Vous pouvez aussi utiliser la page de discussion pour vos recommandations et suggestions d'améliorations.
Le processus Moodle cron est un script PHP, partie intégrante de la distribution standard de Moodle, qui doit être lancé régulièrement. Ce script effectue diverses tâches à différents intervalles programmés.
IMPORTANT ! Ne sauter pas l'étape de configuration du processus cron sur le serveur hébergeant votre installation de Moodle. Votre site ne fonctionnera pas correctement sans lui !
Un programme spécial, habituellement appelé cron, est utilisé pour lancer le script cron de Moodle à intervalles réguliers. Le script cron de Moodle lance plusieurs tâches, notamment l'envoi des courriels, la mise à jour des rapports, des flux RSS, de l'achèvement d'activités, le suivi des messages des forums, etc. Comme ces différentes tâches doivent être lancées à des intervalles différents, toutes les tâches ne sont pas lancées lors de chaque exécution du script cron de Moodle.
Le programme cron (qui lance le script cron de Moodle) fait partie de façon standard des systèmes Unix (y compris Linux et OS X) et est utilisé pour lancer toutes sortes de services dépendant de l'heure. Sous Windows, la solution la plus simple pour répliquer ce comportement est de créer une tâche dans le Gestionnaire des tâches Windows et de la faire lancer à intervalles réguliers. Sur les serveurs mutualisés, il vous faudra trouver la documentation (ou demander de l'assistance) sur la façon de configurer le cron.
Normalement, il s'agit d'ajouter une unique commande à la liste des activités du cron de votre système. Sur les systèmes Unix, cette liste est contenue dans le fichier dénommé crontab, propre à chaque utilisateur.
Discussion générale
Ce paragraphe détaille diverses informations de base. Voyez plus loin pour des instructions propres à votre type de serveur.
There are essentially two steps to implementing cron:
- identifying the correct command to run
- finding the right place on your system to put the command
Working out the Moodle cron command
Moodle has two different ways to deploy cron which use different scripts within the Moodle install. These are as follows...
- The CLI (command line interpreter) script. This will be at the path
/path/to/moodle/admin/cli/cron.php
If in doubt, this is the correct script to use. This needs to be run by a 'PHP CLI' program on your computer. So the final command may look something like/usr/bin/php /path/to/moodle/admin/cli/cron.php
You can (and should) try this on your command line to see if it works. - The web based script. This needs to be run from a web browser and will be accessed via a web url something like http://your.moodle.site/admin/cron.php. You can find command line based web browser (e.g. wget) so the final command may look like
/usr/bin/wget http://your.moodle.site/admin/cron.php
This has the advantage that it can be run from *anywhere*. If you can't get cron to work on your machine it can be run somewhere else.
Finding the right place to put the command
This really does depend on the system you are using and you should find and read the documentation for your platform or hosting. In most cases getting the Moodle cron to run consists of establishing the correct command (above) and then adding it, and the time to run the command, to some sort of file. This might be either through a specific user interface or by editing the file directly.
If using the CLI version you also need to make sure that the cron process is run as the correct user. This is not an issue with the web version.
Example... installing cron on Ubuntu/Debian Linux. Assuming logged in as root..
use the crontab command to open a crontab editor window for the www-data user. This is the user that Apache (the web server) runs as on Debian based systems
$ crontab -u www-data -e
This will open an editor window. To run the cli cron script every 15 minutes, add the line:
*/15 * * * * /usr/bin/php /path/to/moodle/admin/cli/cron.php >/dev/null
NOTE: the final >/dev/null sends all the output to the 'bin' and stops you getting an email every 15 minutes.
Setting up cron on your system
Choose the information for your server type:
- Cron with Unix or Linux- Cron services on various UNIX and Linux flavored operating systems.
- Cron with Windows OS - Cron services in Windows
- Apple OSX - use the built-in 'crontab' service which is exactly the same as Cron with Unix or Linux. However, you might want to do it the 'Apple way' using launchd - see Cron with MAC OS X
- Cron with web hosting services- Cron services in various web hosting examples.
Here are some more instructions for specific hosts (please check that these are up to date):
Using third party cron service
Besides using cron hosted on your own server, you may use third party cron service (usually called webcron):
- EasyCron - A webcron service provider that eliminates the need of crontab or other task schedulers to set cron job.
Cron settings in Moodle
There are settings within Moodle that control aspects of cron operation:
- Cron settings - Moodle cron process password and CLI settings
Remote cron
Using the 'web based' version of cron it is perfectly ok to place the cron process on a different machine to the Moodle server. For example, the cron service on a Unix server can invoke the cron web 'page' on a Windows based Moodle server.
See also
Using Moodle forum discussions:
- Cron - can someone give me a quick confirmation of function?
- Cronjob Question
- Slow cron : avoiding simultaneous cron
- Visibility of cron.php
- How to log the output of a Scheduled Task on Windows - this discussion explains a nice trick that can be very useful when you are experiencing problems with your Windows Scheduled Task and you need to log the output of the Scheduled Task to a log file.