Cron job does not publish on schedule. Manuel run of console maintenance does

Hi Pimcore people.

I’m struggling with getting pimcore to publish on a schedule. Seams the cronjob for console maintenance somehow is not executing right.

This is what i have done so far. I’m on ubuntu 20.04 LTS in a docker container.

I added a cronjob in crontab. Running it as www-data and outputting to a file.

*/5 * * * * www-data php /var/www/html/bin/console maintenance > /var/www/html/log/wwwcron.log

Made sure cron service is running.
/var/www/html/log/wwwcron.log gets updated every 5 minutes. It’s empty.

In pimcore i updated some field of a data object. Created a schedule to publish and save it.
Wait for the next /5 minute. Nothing. The cron job has run with no output from console maintenance.

If i run console maintenance manually the data object gets published.

I tried to run the console maintenance as root from cron as well.

Check that “php” is actually the right version and not 5.6 or something. Also you could try adding -vvv to bin/console as parameter to get more verbose output.

P.S. I always use full path to my php binary! :slight_smile:

Thanks msphn for all the great help! :slight_smile:

:which php

:/usr/local/bin/php -v
PHP 7.2.25 (cli) (built: Nov 22 2019 17:58:22) ( NTS )
Copyright © 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright © 1998-2018 Zend Technologies
with Zend OPcache v7.2.25, Copyright © 1999-2018, by Zend Technologies

New crontab:

*/5 * * * * www-data /usr/local/bin/php /var/www/html/bin/console -vvv maintenance > /var/www/html/log/cron.log

Still just an empty file is created every 5 minutes. Tried as root as well.

Well it works now! The full path must have made the difference.

But no verbose output from console with the -vvv

Thanks msphn!