My elgg Cron doesn't work

I tried to set cron in cpanel of my host server as below for 

*/15  * * * * .../.../ahalim.com/vendor/elgg/elgg/elgg-cli cron -q

When I check if it works on the admin page using cron page I see that nothing has completed

I need help

  • */15  * * * *

    so only every 15 minutes (could be just for testing)

    .../.../ahalim.com/vendor/elgg/elgg/elgg-cli cron -q

    maybe try .../.../ahalim.com/vendor/bin/elgg-cli cron

    that a different directory where the cli command also should be present

    without the '-q' maybe you can see some logs in cpanel which would help in troubleshooting

    you could also try 'php <path to>/vendor/bin/elgg-cli cron' sometimes it needs to be started by PHP instead of detecting PHP.

  • I did your advices, Jerome, but cron still does not seem to work. I wrote what you said to my hosting server, and they applied your second solution "'php <path to>/vendor/bin/elgg-cli cron'". But still no changes in the result.

    In the cron page it displays "never" below "last completed"column. Something is wrong.

  • Ask your hosting to install cron:

    crontab -u www-data -e
    
    * * * * * /usr/bin/php <path to>/vendor/bin/elgg-cli cron -q

    Be sure, your PHP located at /usr/bin/php

    You don't need set cron in cPanel after these changes.

  • Thanks Nikolai,

    I got the reply from my hosting "If your cron configuration that needs to be added is /usr/local/bin/php /home/*****a4/ahalim.com/vendor/bin/elgg-cli cron -q, the edit has been made."

    Is the process made by the hosting server OK? I mean enough?

     

  • Cron Elgg 4 - Full tutorial

    Setup

    crontab -u www-data -e
    
    * * * * * /usr/bin/php /var/www/site/www/vendor/bin/elgg-cli cron -q

    -q flag will supress the output. You can remove it if you want cron logs to be saved on your server (that will flood your server inodes though).

    Test

    For testing you can use an -i and -f flags. 

    -i for interval name, 
    -f for force run even if job is not due.

    Note that you no longer need to setup a gazillion jobs for each period. 

    You only need to setup one cron job that hits the main command every minute. 
    Elgg's cron handler will determine, which cron handlers are due and will run them.

    Force

    php /var/www/site/www/vendor/bin/elgg-cli cron -i hourly -f

    Check

    crontab -u www-data -l

     

  • Now it looks workin but something is still missing. When I look cron page it lists as below. It stops croning after every fifteen minutes

    Cron period Last completed Date and time Message
    Every minute 57 minutes ago Sat, 25 Nov 2023 07:15:02 +0000 Cron jobs for "minute" started at Sat, 25 Nov 2023 07:15:02 +0000
    Cron interval "minute" started processing at Sat, 25 Nov 2023 07:15:02 +0000
    Cron jobs for "minute" completed at Sat, 25 Nov 2023 07:15:02 +0000
    Every five minutes 57 minutes ago Sat, 25 Nov 2023 07:15:02 +0000 Cron jobs for "fiveminute" started at Sat, 25 Nov 2023 07:15:02 +0000
    Cron interval "fiveminute" started processing at Sat, 25 Nov 2023 07:15:02 +0000
    Site notifications cleaning up notifications without linked entities
    Site notifications cleaned up 0 notifications without linked entities

    Cron jobs for "fiveminute" completed at Sat, 25 Nov 2023 07:15:02 +0000
    Every fifteen minutes 57 minutes ago Sat, 25 Nov 2023 07:15:02 +0000 Cron jobs for "fifteenmin" started at Sat, 25 Nov 2023 07:15:02 +0000
    Cron interval "fifteenmin" started processing at Sat, 25 Nov 2023 07:15:02 +0000
    Cron jobs for "fifteenmin" completed at Sat, 25 Nov 2023 07:15:02 +0000
    Every half hour Never    
    Hourly Never    
    Daily Never    
    Weekly Never    
    Monthly Never    
    Yearly Never


     

     

  • "No input file specified." I'm getting a warning from my email account related with the cron