You are not logged in.

Announcement

 Téléchargez la dernière version stable de GLPI      -     Et vous, que pouvez vous faire pour le projet GLPI ? :  Contribuer
 Download last stable version of GLPI                      -     What can you do for GLPI ? :  Contribute

#1 2025-02-19 12:37:27

hoenens
Member
Registered: 2024-12-20
Posts: 16

Sending mails out struggle

Hi,

I noticed a very anoying delay in sending out mails. I did some searching aroudn and found out you can set the settings to cli and make a cronjob.
I did that, but it does not send mails..

I found the installation/cron/php in: /opt/glpi/front/cron.php
I opend crontab -e and entered: */2 * * * * php /opt/glpi/front/cron.php > /dev/null 2>&1

But it's not working. What am i missing here?

Offline

#2 2025-02-19 13:04:54

cconard96
Moderator
Registered: 2018-07-31
Posts: 3,286
Website

Re: Sending mails out struggle

If you haven't read it yet, please refer to the user documentation.
https://glpi-user-documentation.readthe … e-cli-mode

When you added that crontab entry using "crontab -e", you added it to the current user's cron (or root if you used sudo) and that PHP script will run as that user which will either cause some GLPI files to change ownership and break or not have enough permission to access the files needed.

You must have the cron job run as the same user as the web server (www-data, apache, etc).

When you fix the crontab, you will need to verify your GLPI files still have the correct ownership and permissions. Usually the files affected are in "files/_log" and "files/_cache".

You can also have the cron job run every minute rather than every other minute. GLPI will still respect the schedule set for each individual action, but running every minute makes it more accurate.


GLPI Collaborator and Plugin Developer.
My non-English comments are automated translations. Sorry for any confusion that causes.
Mes commentaires non anglais sont des traductions automatiques. Désolé pour toute confusion qui cause.
Mis comentarios que no están en inglés son traducciones automáticas. Perdón por cualquier confusión que cause.

Offline

#3 2025-02-19 13:39:01

hoenens
Member
Registered: 2024-12-20
Posts: 16

Re: Sending mails out struggle

*/2 * * * * /usr/bin/php /opt/glpi/front/cron.php > /dev/null 2>&1

This was the solution, fixed it big_smile

Offline

#4 2025-02-19 14:01:32

hoenens
Member
Registered: 2024-12-20
Posts: 16

Re: Sending mails out struggle

When you added that crontab entry using "crontab -e", you added it to the current user's cron (or root if you used sudo) and that PHP script will run as that user which will either cause some GLPI files to change ownership and break or not have enough permission to access the files needed.

You must have the cron job run as the same user as the web server (www-data, apache, etc).

When you fix the crontab, you will need to verify your GLPI files still have the correct ownership and permissions. Usually the files affected are in "files/_log" and "files/_cache".

You can also have the cron job run every minute rather than every other minute. GLPI will still respect the schedule set for each individual action, but running every minute makes it more accurate.

Well it works fine under root, but to follow your advise i did put the cron job under user www-data.
Ty for the advise!

Offline

#5 2025-02-19 14:04:13

hoenens
Member
Registered: 2024-12-20
Posts: 16

Re: Sending mails out struggle

* * * * * /usr/bin/php /opt/glpi/front/cron.php > /dev/null 2>&1

And, i changed it to this smile

Offline

Board footer

Powered by FluxBB