I found two similar questions, but wasn't helped by them.
I have a Symfony command that is working when I enter:
/usr/bin/php /home/bob/example_project/bin/console app:slack
I tried to make a crontab (run every minute) with sudo crontab -e
:
MAILTO=""
* * * * * /usr/bin/php /home/bob/example_project/bin/console app:slack
But it's not working. I can't find any error messages either. sudo grep CRON /var/log/syslog
gives:
Apr 10 13:21:01 example_project CRON[23432]: (root) CMD (/usr/bin/php /home/bob/example_project/bin/console app:slack)
Using sudo crontab -e -u bob
or sudo crontab -e -u www-data
doesn't change anything.
What could I be doing wrong?
- EDIT The logfile.log has this:
PHP Fatal error: Uncaught Symfony\Component\Debug\Exception\ClassNotFoundException: Attempted to load class "SensioGeneratorBundle" from namespace "Sensio\Bundle\Gene$ Did you forget a "use" statement for another namespace? in /home/bob/example_project/app/AppKernel.php:25 Stack trace: 0 /home/bob/example_project/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php(403): AppKernel->registerBundles() 1 /home/bob/example_project/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php(113): Symfony\Component\HttpKernel\Kernel->initializeBundles() 2 /home/bob/example_project/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Console/Application.php(68): Symfony\Component\HttpKernel\Kernel->boot() 3 /home/bob/example_project/vendor/symfony/symfony/src/Symfony/Component/Console/Application.php(120): Symfony\Bundle\FrameworkBundle\Console\Application->doRun(Object(Sy$ 4 /home/bob/example_project/bin/console(28): S in /home/bob/example_project/app/AppKernel.php on line 25
....bin/console app:slack >> logfile.log 2>&1
– JustOnUnderMillions* * * * * export SYMFONY_ENV=prod && /usr/bin/php /home/bob/example_project/bin/console app:slack
. Is there a better way or is this fine? – twharmonAppKernel.php
. I dont like this part ``` "Sensio\Bundle\Gene$``` of your log file. Regards. – Viktor