Skip to content

Fix(Crontab): highlight the need for proper crontab setup and CLI execution #155

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

stonebuzz
Copy link
Contributor

@stonebuzz stonebuzz commented Jul 15, 2025

This PR improves the documentation of crontab configuration for running GLPI CLI tasks.

Changes

  • Emphasizes the need to use the proper web server user (www-data, apache, etc.) when setting up the crontab.
  • Provides a more complete crontab example that includes changing the working directory (cd) before running the PHP command.
  • Adds guidance on using sudo -u to run CLI tasks manually as the correct user.
  • Specifies that the full path to the PHP binary (e.g., /usr/bin/php) may be needed if it's not available in the environment PATH.

@stonebuzz stonebuzz requested a review from trasher July 15, 2025 08:02
@stonebuzz stonebuzz requested a review from cedric-anne July 15, 2025 08:02
Comment on lines +22 to +26
For Linux/MacOS, you should add the following to the web server's user's (**www-data, apache, etc**) crontab:

::

* * * * * www-data cd GLPI/front && php cron.php
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either you use the user crontab, and you do not to specify user name, or you use the global crontab and you must add the user name to use for run.
Seems inconsistent here.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It may be OK to document both options separately as some user may want to manage all "system" crontabs together and not use the web server user's crontab.

I don't see the functional difference of changing the actual command from "php GLPI/front/cron.php" to "cd GLPI/front && php cron.php".

@@ -33,7 +37,15 @@ To execute a specific action from the command-line, you can run (for mailgate ac

php GLPI/front/cron.php --force mailgate


Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe duplucating the same remarks should be avoid addign a paragraph on cron configuration independant of the way it's run?

You will need to replace `GLPI` with the path to your GLPI folder.
You may also need to replace `php` with the full path to your php binary if it is not in the PATH (`/usr/bin/php`).
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should suggest replacing it with the path to the specific version of PHP loaded in the web server for GLPI, whether that be the Apache module, FPM, etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants