Question
Cronjobs getting the best of me ... Command line works, same command in Crontab does not!
Hi …
I’ve installed Mautic (email program). It needs 3 cronjobs to run properly.
- php /var/www/mydomainname/htdocs/app/console mautic:segments:update
- php /var/www/mydomainname/htdocs/app/console mautic:campaigns:update
- php /var/www/mydomainname/htdocs/app/console mautic:campaigns:trigger
I am on ubuntu 18.04 and am using PHP 7.0x.
When I do : sudo php /var/www/mydomainname/htdocs/app/console mautic:campaigns:trigger - or any other of the 3 listed above, they work without problem. I get the correct output and it’s executed.
However, when I put the same commands in a crontab, nothing happens.
I’ve tried everything. In the root crontab, in the www-data crontab, in my user crontab, with absolute paths to the PHP7.0 command (in /usr/bin/php7.0). Even tried first chaning to the php directory and what not.
For example :
- * * * /usr/bin/php7.0 /var/www/mydomainname/htdocs/app/console mautic:segments:update
or
- * * * sudo /usr/bin/php7.0 /var/www/mydomainname/htdocs/app/console mautic:segments:update
or
- * * * cd /usr/bin sudo php7.0 /var/www/mydomainname/htdocs/app/console mautic:segments:update
Nothing does the trick when using crontab.
Anyone know why?
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
×