Really quick post about setting up cron to work with GLPI because I spent way to long trying to figure out something that should be extremely trivial.
First off, GLPI defaults to using a pseudo-cron routine which means no cron jobs get run unless users are interacting with the GLPI site. If your GLPI site is heavily used this wouldn't be a problem but in my case most users were interacting with GLPI via its email system. This means that emailed tickets were getting held up until users logged onto the GLPI site.
To fix this we simply change GLPI to use real cron instead of it's pseudo-cron.
The first step is to go to the Automatic actions page and click on the mailgate action. You then need to change Run mode form GLPI to CLI. I believe this step tells GLPI to stop using its pseudo-cron to perform this action and to start using real cron. At this point you can manually trigger cron to see if it works. Change Run frequency to 1 minute then wait a minute and run the following command sudo /usr/bin/php5 /usr/share/glpi/front/cron.php &>/dev/null
. If everything is working properly when you refresh the page the last run time should be the current time.
Now we need to automate this using cron. To do this run sudo crontab -e
and add the following line */2 * * * * /usr/bin/php5 /usr/share/glpi/front/cron.php &>/dev/null
. This tells cron to run the cron.php
task every 2 minutes. You should now be able to refresh your website and see that every two minutes the mailgate action is run. You can also change any of the other actions to use CLI mode as well.
Comments
Victor Fiorante (not verified)
January 27, 2014 - 03:52
Permalink
Thanks a lot !!
Thanks a lot !!
Rodrigo (not verified)
May 11, 2014 - 18:05
Permalink
Very helpful
Thx a lot, very explained!
Jack (not verified)
July 28, 2017 - 00:54
Permalink
Cron from glpi to os cron
Thanks - very helpful, try this problem to much time!!!
Anonymous (not verified)
August 21, 2017 - 03:15
Permalink
essay writer
essay writer