By Lex Gabrees
Hi …
I’ve installed Mautic (email program). It needs 3 cronjobs to run properly.
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 :
or
or
Nothing does the trick when using crontab.
Anyone know why?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Hello,
This is quite interesting. One thing that I’m noticing from your description is that when running the command manually you use sudo, would you mind confirming if the cronjobs that you are setting are under the root user or your low privileged user? My guess would be that your low privileged user does not have privileges to access the files in the /var/www/mydomainname/ directory.
Also, another suggestion here would be to add the following to your cronjobs: >>/path/to/somefile.log 2>&1 that way in the logs you would see some more information regarding what might be wrong with the jobs.
Hope that this helps! Regards, Bobby
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.